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