www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



c++ - How the access the HOME END keys in a console application

↑ ↓ ← Ed Schroder <matador home.nl> writes:
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
Jan 05 2007
→ Walter Bright <newshound digitalmars.com> writes:
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.
Jan 05 2007
Bertel Brander <bertel post4.tele.dk> writes:
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
Jan 05 2007
↑ ↓ → Ed Schroder <matador home.nl> writes:
Got it working..... thx Bertil & Walter!

Regards,

Ed
Jan 05 2007