[fpc-devel]Bug in structs.inc / TInputRecord

Thomas Schatzl tom_at_work at yline.com
Fri Aug 3 13:51:36 CEST 2001


Hello,

    noticed a bug in the type definition of the InputRecord record used in
Win32 keyboard handling causing problems with input in conjunction with
W2k/NT + crt unit. Somehow with W9x this doesn't show up....

Here is the correct type definition:

type
  PInputRecord = ^TInputRecord;
  _INPUT_RECORD = record
    EventType: Word;
    Reserved: Word;   // this record member was missing
    case Integer of
      0: (KeyEvent: TKeyEventRecord);
      1: (MouseEvent: TMouseEventRecord);
      2: (WindowBufferSizeEvent: TWindowBufferSizeRecord);
      3: (MenuEvent: TMenuEventRecord);
      4: (FocusEvent: TFocusEventRecord);
  end;

Note that in Delphi this record is different, it rather looks like the
following:

type
  PInputRecord = ^TInputRecord;
  _INPUT_RECORD = record
    EventType: Word;
    Reserved: Word;
    Event : record case Integer of
      0: (KeyEvent: TKeyEventRecord);
      1: (MouseEvent: TMouseEventRecord);
      2: (WindowBufferSizeEvent: TWindowBufferSizeRecord);
      3: (MenuEvent: TMenuEventRecord);
      4: (FocusEvent: TFocusEventRecord);
    end;
  end;

Checked with today's rtl source snapshot (1.1 version).

Regards,
    Thomas








More information about the fpc-devel mailing list