Subclassing XP Console Window

September 25th, 2005 - 04:30 am ET by Sk8Kid | Report spam
Hello,
Is there a way to subclass the console window? SetWindowLong,
using the handle returned from GetConsoleWindow, returns
an "Invalid index" code. I'd like to prevent a user from
pressing Alt+Enter to go into fullscreen mode and I though
subclassing and overriding WM_SYSKEYDOWN might do the trick.

Thanks,
Steve
email Follow the discussionReplies 4 repliesReplies Make a reply

Similar topics

Replies

#1 James Brown
September 25th, 2005 - 06:09 am ET | Report spam
"Sk8Kid" wrote in message
news:
Hello,
Is there a way to subclass the console window? SetWindowLong,
using the handle returned from GetConsoleWindow, returns
an "Invalid index" code. I'd like to prevent a user from
pressing Alt+Enter to go into fullscreen mode and I though
subclassing and overriding WM_SYSKEYDOWN might do the trick.

Thanks,
Steve




It is not possible to subclass console windows, sorry - they are
a special "protected" window class and are quite different from standard
GUI window because the console WndProc is implemented inside
CSRSS.EXE, even though console windows are owned by the client
process (e.g. CMD.EXE)


James

www.catch22.net
Free win32 software, sourcecode and tutorials
Replies Reply to this message
#2 Christian ASTOR
September 25th, 2005 - 08:07 am ET | Report spam
Sk8Kid wrote:

Is there a way to subclass the console window? SetWindowLong,
using the handle returned from GetConsoleWindow, returns
an "Invalid index" code. I'd like to prevent a user from
pressing Alt+Enter to go into fullscreen mode and I though
subclassing and overriding WM_SYSKEYDOWN might do the trick.



eg WH_KEYBOARD_LL
Replies Reply to this message
#3 Gary Chanson
September 25th, 2005 - 03:07 pm ET | Report spam
"Sk8Kid" wrote in message
news:
Hello,
Is there a way to subclass the console window? SetWindowLong,
using the handle returned from GetConsoleWindow, returns
an "Invalid index" code. I'd like to prevent a user from
pressing Alt+Enter to go into fullscreen mode and I though
subclassing and overriding WM_SYSKEYDOWN might do the trick.



You can't subclass the console window and you can't use message hooks on
it. You might be able to use a WH_KEYBOARD_LL hook to trap this key
combination when the console is the foreground window and prevent it being
passed through.


- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools
Replies Reply to this message
#4 A.J.
September 25th, 2005 - 05:22 pm ET | Report spam
cool guys, thanks for the replies. i'll give the
keyboard hook a try.
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search