1 |
plugwash |
40 |
unit wmessages;
|
2 |
|
|
//this unit contains varions functions and types to make it easier to write
|
3 |
|
|
//code that works with both real windows messages and lmessages
|
4 |
|
|
|
5 |
|
|
interface
|
6 |
|
|
uses windows,messages,pgtypes;
|
7 |
|
|
type
|
8 |
|
|
thinstance=thandle;
|
9 |
|
|
thevent=thandle;
|
10 |
|
|
|
11 |
|
|
//according to MS you are supposed to use get/setwindowlongptr to get/set
|
12 |
|
|
//pointers in extra window memory so your program can be built for win64, this
|
13 |
|
|
//is also the only interface to window memory that lmessages offers but delphi
|
14 |
|
|
//doesn't define it so alias it to getwindowlong here for win32.
|
15 |
|
|
{$ifndef win64} //future proofing ;)
|
16 |
|
|
function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint;
|
17 |
|
|
procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint);
|
18 |
|
|
{$endif}
|
19 |
|
|
function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall;
|
20 |
|
|
implementation
|
21 |
|
|
{$ifndef win64}
|
22 |
|
|
function getwindowlongptr(ahwnd:hwnd;nindex:integer) : taddrint;
|
23 |
|
|
begin
|
24 |
|
|
result := getwindowlong(ahwnd,nindex);
|
25 |
|
|
end;
|
26 |
|
|
procedure setwindowlongptr(ahwnd:hwnd;nindex:integer;dwNewLong : taddrint);
|
27 |
|
|
begin
|
28 |
|
|
setwindowlong(ahwnd,nindex,dwnewlong);
|
29 |
|
|
end;
|
30 |
|
|
{$endif}
|
31 |
|
|
function WaitForSingleEvent(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall;
|
32 |
|
|
begin
|
33 |
|
|
result := waitforsingleobject(hhandle,dwmilliseconds);
|
34 |
|
|
end;
|
35 |
|
|
end. |