Jump to content
Xtreme .Net Talk

multiple keyboard events on single key


Recommended Posts

Guest PaltryProgrammer
Posted

Running the code below and pressing a key once results in two separate keyboard events with the output being

 

1

1

 

Kindly advise Thank You Cheerios

 

#include <iostream>

#include <cassert>

#include <windows.h>

 

void keyboard(HANDLE hstd_input)

{

INPUT_RECORD input_record;

DWORD nevents = 0;

BOOL ok = ReadConsoleInput(hstd_input, &input_record, 1, &nevents);

assert(ok);

std::wcout << nevents << std::endl;

}

 

int main()

{

HANDLE hstd_input = GetStdHandle(STD_INPUT_HANDLE);

keyboard(hstd_input);

keyboard(hstd_input);

}

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...