tbs0329.pp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {$packrecords c}
  2. type
  3. SHORT=smallint;
  4. WINBOOL = longbool;
  5. WCHAR=word;
  6. UINT=cardinal;
  7. COORD = record
  8. X : SHORT;
  9. Y : SHORT;
  10. end;
  11. KEY_EVENT_RECORD = packed record
  12. bKeyDown : WINBOOL;
  13. wRepeatCount : WORD;
  14. wVirtualKeyCode : WORD;
  15. wVirtualScanCode : WORD;
  16. case longint of
  17. 0 : ( UnicodeChar : WCHAR;
  18. dwControlKeyState : DWORD; );
  19. 1 : ( AsciiChar : CHAR );
  20. end;
  21. MOUSE_EVENT_RECORD = record
  22. dwMousePosition : COORD;
  23. dwButtonState : DWORD;
  24. dwControlKeyState : DWORD;
  25. dwEventFlags : DWORD;
  26. end;
  27. WINDOW_BUFFER_SIZE_RECORD = record
  28. dwSize : COORD;
  29. end;
  30. MENU_EVENT_RECORD = record
  31. dwCommandId : UINT;
  32. end;
  33. FOCUS_EVENT_RECORD = record
  34. bSetFocus : WINBOOL;
  35. end;
  36. INPUT_RECORD = record
  37. EventType : WORD;
  38. case longint of
  39. 0 : ( KeyEvent : KEY_EVENT_RECORD );
  40. 1 : ( MouseEvent : MOUSE_EVENT_RECORD );
  41. 2 : ( WindowBufferSizeEvent : WINDOW_BUFFER_SIZE_RECORD );
  42. 3 : ( MenuEvent : MENU_EVENT_RECORD );
  43. 4 : ( FocusEvent : FOCUS_EVENT_RECORD );
  44. end;
  45. begin
  46. if sizeof(INPUT_RECORD)<>20 then
  47. begin
  48. writeln('Wrong packing for Packrecords C and union ',sizeof(INPUT_RECORD),' instead of ',20);
  49. halt(1);
  50. end;
  51. end.