--- /dev/null
+unit wmessages;\r
+//this unit contains varions functions and types to make it easier to write\r
+//code that works with both real windows messages and lmessages\r
+\r
+interface\r
+uses windows,messages,pgtypes;\r
+type\r
+ thinstance=thandle;\r
+ thevent=thandle;\r
+\r
+//according to MS you are supposed to use get/setwindowlongptr to get/set\r
+//pointers in extra window memory so your program can be built for win64, this\r
+//is also the only interface to window memory that lmessages offers but delphi\r
+//doesn't define it so alias it to getwindowlong here for win32.\r
+{$ifndef win64} //future proofing ;)\r
+ function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint;\r
+ procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint);\r
+{$endif}\r
+function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall;\r
+implementation\r
+{$ifndef win64}\r
+ function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint;\r
+ begin\r
+ result := getwindowlong(ahwnd,nindex);\r
+ end;\r
+ procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint);\r
+ begin\r
+ setwindowlong(ahwnd,nindex,dwnewlong);\r
+ end;\r
+{$endif}\r
+function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall;\r
+begin\r
+ result := waitforsingleobject(hhandle,dwmilliseconds);\r
+end;\r
+end.
\ No newline at end of file