X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/4e23b915756617cac9c6c413c14106d066085d74..0cf8242b7bb005541896b8ab6363b147ff22f454:/wmessages.pas?ds=inline diff --git a/wmessages.pas b/wmessages.pas new file mode 100644 index 0000000..fed9259 --- /dev/null +++ b/wmessages.pas @@ -0,0 +1,35 @@ +unit wmessages; +//this unit contains varions functions and types to make it easier to write +//code that works with both real windows messages and lmessages + +interface +uses windows,messages,pgtypes; +type + thinstance=thandle; + thevent=thandle; + +//according to MS you are supposed to use get/setwindowlongptr to get/set +//pointers in extra window memory so your program can be built for win64, this +//is also the only interface to window memory that lmessages offers but delphi +//doesn't define it so alias it to getwindowlong here for win32. +{$ifndef win64} //future proofing ;) + function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint; + procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint); +{$endif} +function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall; +implementation +{$ifndef win64} + function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint; + begin + result := getwindowlong(ahwnd,nindex); + end; + procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint); + begin + setwindowlong(ahwnd,nindex,dwnewlong); + end; +{$endif} +function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall; +begin + result := waitforsingleobject(hhandle,dwmilliseconds); +end; +end. \ No newline at end of file