Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Oct : KEY_EVENT_RECORD definition confusion...

www.cryer.info
Managed Newsgroup Archive

KEY_EVENT_RECORD definition confusion...

Subject:KEY_EVENT_RECORD definition confusion...
Posted by:"Rich" (someo..@somewhere.com)
Date:25 Oct 2005 09:31:31 -0700

Using D5.01.  From Windows.pas:

  {$EXTERNALSYM _KEY_EVENT_RECORD}
  _KEY_EVENT_RECORD = packed record
    bKeyDown: BOOL;
    wRepeatCount: Word;
    wVirtualKeyCode: Word;
    wVirtualScanCode: Word;
    case Integer of
      0: (
        UnicodeChar: WCHAR;
        dwControlKeyState: DWORD);
      1: (
        AsciiChar: CHAR);
  end;

This appears to me to indicate that the dwControlKeyState and AsciiChar
fields are mutually exclusive.  However in MSDN I find the following
which seems to imply that dwControlKeyState is always defined.

typedef struct _KEY_EVENT_RECORD
{  BOOL bKeyDown;  WORD wRepeatCount;
   WORD wVirtualKeyCode;
   WORD wVirtualScanCode;
   union {
     WCHAR UnicodeChar;
     CHAR AsciiChar;
   } uChar;
   DWORD dwControlKeyState;
} KEY_EVENT_RECORD;

Can someone help clarify my understanding?  TIA, Rich

Glossary

File Types

Replies:

www.cryer.info
Managed Newsgroup Archive