Hi all,
I'm new member of this forum. Previously I used TMT Pascal but now I decided to try Lazarus environment.
As I usually wrote my Windows GUI programs using "clean" WINAPI functions and message loop, I would like to know if it is possible in Lazarus, too.
I have written the following code:
program Window1; uses Windows, Strings, Messages;
var Msg : TMsg;
Wnd : HWnd;
wc : TWndClass;
function WinProc(Window: HWND; Mess: UInt; WParam: WParam; LParam: LParam ): UInt; stdcall;
begin
Result := 0;
case Mess of
WM_CLOSE: Result :=WinProc(Window, Mess, WParam, LParam);
WM_DESTROY: PostQuitMessage(0);
else
Result:=WinProc(Window, Mess, WParam, LParam);
end;
end;
begin
FillChar( wc, SizeOf( wc ), 0 );
with wc do
begin
style:=CS_HREDRAW + CS_VREDRAW;
lpfnWndProc:=@WinProc;
cbClsExtra:=0;
cbWndExtra:=0;
hInstance:=System.hInstance;
hCursor:=LoadCursor( THandle( NIL ), IDC_ARROW );
hbrBackGround := COLOR_WINDOW + 1;
lpszMenuName:=nil;
lpszClassName:='First GUI App';
end;
if RegisterClass( wc ) = 0 then Exit;
Wnd:=CreateWindow( wc.lpszClassName, 'ListView', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 400, 0, 0, HInstance, nil );
repeat
while GetMessage( Msg, 0, 0, 0 ) do
begin
TranslateMessage( Msg );
DispatchMessage( Msg );
end;
until Msg.Message = WM_QUIT;
end.
For the line: lpfnWndProc:=@WinProc;, the compiler reports the following error:
window1.lpr(29,18) Error: Incompatible types: got "<address of function(QWord,LongWord,Int64,Int64):DWord;StdCall>" expected "<procedure variable type of function(QWord,LongWord,Int64,Int64):Int64;StdCall>"
Can anybody help me with this problem?
Thanks in advance
Conrad