On Tue, 31 Oct 2006 13:28:40 -0200
"Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> On win32wscontrols file we can see this structure:
>
> type
> TCreateWindowExParams = record
> Buddy, Parent, Window: HWND;
> Left, Top, Height, Width: integer;
> WindowInfo, BuddyWindowInfo: PWindowInfo;
> MenuHandle: HMENU;
> Flags, FlagsEx: dword;
> SubClassWndProc: pointer;
> WindowTitle, StrCaption: PChar;
> pClassName: PChar;
> end;
>
> And on the FinishCreateWindow function, I tryed to conver this
> statement:
>
> Window := CreateWindowEx(FlagsEx, pClassName, WindowTitle,
> Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, Nil);
>
> My initial idea was to do this:
>
> {$ifdef WindowsUnicodeSupport}
> Window := CreateWindowExW(FlagsEx,
> PWideChar(Utf8Decode(string(pClassName))),
> PWideChar(Utf8Decode(string(WindowTitle))), Flags,
> Left, Top, Width, Height, Parent, MenuHandle, HInstance,
> Nil); {$else}
> Window := CreateWindowEx(FlagsEx, pClassName, WindowTitle,
> Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, Nil);
> {$endif}
>
> But it seams ugly, doesn´t it? I mean, too many casts.
>
> It would be better if TCreateWindowExParams had string parameters
> instead of PChar parameters, to avoid casting strings to PChar and
> then back to string. What do you guys think? I´m afraid it may take
> too long, and even create new bugs if I try to do a general swep to
> change TCreateWindowEXParam parameters to string.
Some overrides would be useful. Instead of
PWideChar(Utf8Decode(string(pClassName))),
write a function so you can write
PWideChar(Utf8PCharToWS(pClassName))
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives