You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wmessages.pas 1.5KB

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