Hey guys, I´m having trouble with basic unicode windows functions.
I created a very simple demo app that just creates an window. My objective is to see a correct title on the window that should be "fpGFX Window" If UnicodeEnabledOS is set to False, it works correctly. If it´s set to True, I can only see "f" on the window title. Can anyone help me? thanks program winnt; {$mode objfpc}{$H+} uses SysUtils, Classes, Windows; function fpGFXWindowProc(hwnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; begin Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); end; var WindowClass: TWndClass; WindowClassW: TWndClassW; UnicodeEnabledOS: Boolean; Handle: THandle; begin UnicodeEnabledOS := True; FillChar(WindowClass, SizeOf(TWndClass), #0); FillChar(WindowClassW, SizeOf(TWndClassW), #0); // Initialize a window class, if necessary if UnicodeEnabledOS then begin WindowClassW.style := CS_HREDRAW or CS_VREDRAW; WindowClassW.hInstance := MainInstance; WindowClassW.lpfnWndProc := WndProc(@fpGFXWindowProc); WindowClassW.lpszClassName := 'fpGFX'; WindowClassW.hIcon := LoadIcon(0, IDI_APPLICATION); WindowClassW.hCursor := LoadCursor(0, IDC_ARROW); Windows.RegisterClassW(@WindowClassW); end else begin WindowClass.style := CS_HREDRAW or CS_VREDRAW; WindowClass.hInstance := MainInstance; WindowClass.lpfnWndProc := WndProc(@fpGFXWindowProc); WindowClass.lpszClassName := 'fpGFX'; WindowClass.hIcon := LoadIcon(0, IDI_APPLICATION); WindowClass.hCursor := LoadCursor(0, IDC_ARROW); Windows.RegisterClass(@WindowClass); end; if UnicodeEnabledOS then Handle := Windows.CreateWindowExW( WS_EX_APPWINDOW, // extended window style 'fpGFX', // registered class name 'fpGFX Window', // window name WS_OVERLAPPEDWINDOW, // window style CW_USEDEFAULT, // horizontal position of window CW_USEDEFAULT, // vertical position of window CW_USEDEFAULT, // window width CW_USEDEFAULT, // window height 0, // handle to parent or owner window 0, // menu handle or child identifier MainInstance, // handle to application instance nil) // window-creation data else Handle := Windows.CreateWindowEx( WS_EX_CLIENTEDGE, // extended window style 'fpGFX', // registered class name 'fpGFX Window', // window name WS_OVERLAPPEDWINDOW, // window style CW_USEDEFAULT, // horizontal position of window CW_USEDEFAULT, // vertical position of window CW_USEDEFAULT, // window width CW_USEDEFAULT, // window height 0, // handle to parent or owner window 0, // menu handle or child identifier MainInstance, // handle to application instance nil); // window-creation data ShowWindow(Handle, SW_SHOWNORMAL); Sleep(5000); end. _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives