Forum > Windows
[Solved] Windows 11 64 Bit and FPC 3.2.2
(1/1)
JSN:
I recently switched from Lazarus 32 Bit to Lazarus 64 Bit (FPC 3.2.2). There are some very substantial enhancements and improvements. Thank you to everyone who has been working on Lazarus to bring Lazarus to its current state.
I have been using the following code for many years within Lazarus 32 Bit.
When I recently switched to 64 Bit, the only line of code that has a hiccup is the assignment of PrevWndProc statement.
Everything else compiles.
From the Lazarus Installation (C:\Lazarus\LCL), GWL_WNDPROC is defined in LCLType.pp as:
GWL_WNDPROC = -4;
From the Lazarus Installation, WNDPROC is defined in C:\Lazarus\fpc\3.2.2\source\rtl\win\wininc\base.inc as:
WNDPROC = function (_para1:HWND; _para2:UINT; _para3:WPARAM; _para4:LPARAM):LRESULT;stdcall;
In the unit variable section of my project, PrevWndProc is defined:
var
PrevWndProc: WNDPROC;
Additionally, WndCallBack is defined as:
function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall;
The following line of code used to compile fine in 32 Bit:
PrevWndProc := Windows.WNDPROC(SetWindowLong(Self.Handle,GWL_WNDPROC,PtrInt(@WndCallback)));
But now it has a problem in 64 Bit (FPC 3.2.2) with this error:
Illegal Type Conversion: "LongInt" to <procedure variable type of function(QWord;LongWord;Int64;Int64):Int64;StdCall;
Can someone help me with a solution, please?
Thank you.
440bx:
Change "SetWindowLong" to "SetWindowLongPtr".
That will likely correct the problem.
JSN:
--- Quote from: 440bx on May 03, 2024, 07:12:04 am ---Change "SetWindowLong" to "SetWindowLongPtr".
That will likely correct the problem.
--- End quote ---
That definitely DID fix the problem. Thank you very much!
Do you have a means for me to anonymously buy you a "cup of coffee" as appreciation for you assistance?
440bx:
--- Quote from: JSN on May 05, 2024, 10:54:26 am ---Do you have a means for me to anonymously buy you a "cup of coffee" as appreciation for you assistance?
--- End quote ---
You're welcome. I appreciate the gratitude, go out have a cup of coffee _for_ me. :)
Navigation
[0] Message Index