tb0277.pp 1.5 KB

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