[fpc-pascal] Help making code unicode capable
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Sat Nov 10 15:08:50 CET 2007
Hello,
I have a small piece of code on LCL which I have found hard to convert
to unicode:
lpStrFilter := StrAlloc(Length(Filter)+1);
StrPCopy(lpStrFilter, Filter);
on win32wsdialogs.pp
lpStrFilter is a member on the LPOPENFILENAME winapi structure.
Having a win9x version is trivial, but having a version where we put a
PWideChar into lpStrFilter looks hard...
lpStrFilter := StrAlloc(Length(Filter)+1);
StrPCopy(lpStrFilter, Utf8ToAnsi(Filter));
I tryed this as unicode version:
lpStrFilter := PChar(PWideChar(Utf8Decode(Filter)));
But it crashes the dialog when it is closed... I don't know what
exactly is happening here, or why the original code manually alocated
memory and then copyed the string, instead of just copying, so I'm
lost about solving this.
thanks,
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list