Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 05, 2007 How the access the HOME END keys in a console application | ||||
---|---|---|---|---|
| ||||
As the title says..... Under DOS I was used to get access to the HOME / END / DEL / PAGE- UP etc. keys using the _bios_keybrd(0) function. This function is not available in a console application. So how does one get access? TIA Ed |
January 05, 2007 Re: How the access the HOME END keys in a console application | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ed Schroder | Ed Schroder wrote: > As the title says..... > > Under DOS I was used to get access to the HOME / END / DEL / PAGE- > UP etc. keys using the _bios_keybrd(0) function. This function is > not available in a console application. > > So how does one get access? Download ftp://ftp.digitalmars.com/me.zip, which has example code in it to do that. |
January 05, 2007 Re: How the access the HOME END keys in a console application | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ed Schroder | Ed Schroder skrev: > As the title says..... > > Under DOS I was used to get access to the HOME / END / DEL / PAGE- > UP etc. keys using the _bios_keybrd(0) function. This function is > not available in a console application. #include <windows.h> #include <iostream> HANDLE StdIn = GetStdHandle(STD_INPUT_HANDLE); WORD GetChar() { DWORD NumEventsRead; INPUT_RECORD InputRecord; while(1) { if(!ReadConsoleInput(StdIn, &InputRecord, 1, &NumEventsRead)) return 0; if(InputRecord.EventType & KEY_EVENT && InputRecord.Event.KeyEvent.bKeyDown) { if(InputRecord.Event.KeyEvent.wVirtualKeyCode != VK_CONTROL && InputRecord.Event.KeyEvent.wVirtualKeyCode != VK_MENU && InputRecord.Event.KeyEvent.wVirtualKeyCode != VK_SHIFT) { return InputRecord.Event.KeyEvent.wVirtualKeyCode; } } } } int main() { std::cout << "Hit Esc to exit" << std::endl; WORD Ch; while((Ch = GetChar()) != VK_ESCAPE) { switch(Ch) { case VK_END: std::cout << "End" << std::endl; break; case VK_HOME: std::cout << "Home" << std::endl; break; } } } -- Just another homepage: http://damb.dk But it's mine - Bertel |
January 05, 2007 Re: How the access the HOME END keys in a console application | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander | Got it working..... thx Bertil & Walter! Regards, Ed |
Copyright © 1999-2021 by the D Language Foundation