From: plugwash Date: Sun, 15 Feb 2009 03:25:51 +0000 (+0000) Subject: add wmessages.pas (conviniance unit to make it easier to write code that works with... X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/0cf8242b7bb005541896b8ab6363b147ff22f454 add wmessages.pas (conviniance unit to make it easier to write code that works with both windows messages and lmessages) git-svn-id: file:///svnroot/lcore/trunk@40 b1de8a11-f9be-4011-bde0-cc7ace90066a --- 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