Groups | Blog | Home
all groups > c# > july 2003 >

c# : console app problem


Chris Williams
7/16/2003 9:36:18 PM
Hi...

I'm trying to find some code samples that will show me how to capture
non-character keypresses in a console app. I've tried the standard stuff,
such as console.read and console.readline, and I've tried ConsoleEx which
does a great job, but still doesn't handle non-character keys like CTRL and
the arrow keys.

I've read the character mode apps page on MSDN, and couldn't really make
much sense out of it.

So I guess my question is, has ANYONE successfully trapped arrow keys in a
console app, using C#, C++.net, or VB.net? I would really reaaaaally
appreciate any help I can get, thanks.

Finally, if I can't do it, I'll need to write it as a windows app... so the
question is, how do I write to the screen of a windows app, as if it were a
console? (I've seen it done, I just don't know how.)

Thanks,

Chris

--
development journal: http://www.mystictriad.com/dev
Heroic Adventure 0.1.1 (HA! for short)
Probably the first Roguelike written in VB.NET

Patrick Steele [MVP]
7/16/2003 11:28:41 PM
In article <e$t2EPATDHA.2676@TK2MSFTNGP10.phx.gbl>,
spam@spamspamspamspam.com says...
[quoted text, click to view]

Maybe if you put the console into character mode instead of line mode
you could capture the keystrokes you're looking for. See this post:

http://tinyurl.com/h6nm

--
Patrick Steele
Microsoft .NET MVP
Vincent Wiegel
7/17/2003 4:01:04 AM
[quoted text, click to view]

Do I understand this correctly, your trying to make a Windows App
behave/emulate a Console App?

~V


[quoted text, click to view]

Chris Williams
7/17/2003 8:42:19 PM
character mode does allow me to trap character keys, but I still cant get
the non-character keys like Ctrl and Shift and the arrow keys, etc...

Thanks though,

S.

--
development journal: http://www.mystictriad.com/dev
Heroic Adventure 0.1.1 (HA! for short)
Probably the first Roguelike written in VB.NET


[quoted text, click to view]

AddThis Social Bookmark Button