1 |
plugwash |
41 |
{ 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 |
plugwash |
40 |
unit wmessages;
|
7 |
beware |
136 |
//this unit contains various functions and types to make it easier to write
|
8 |
plugwash |
149 |
//code that works with both real windows messages and lcoremessages
|
9 |
plugwash |
40 |
|
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 |
plugwash |
149 |
//is also the only interface to window memory that lcoremessages offers but delphi
|
19 |
plugwash |
40 |
//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. |