Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Subclassing console window

15 views
Skip to first unread message

Roland Richter

unread,
Jul 6, 1998, 3:00:00 AM7/6/98
to

Hi everybody!

I want to write a GUI-application for NT, that uses the abilities of a
console for its main window.

So I tried CreateWindow("ConsoleWindowClass",...), but Windows returns
"Cannot find window class".

Then I created a console by AllocConsole() and took its window handle to
set a menu to the console. That works fine, but to process the
WM_COMMAND-messages I need to subclass the window:

SetWindowLong(hwndConsole,GWL_WNDPROC,(LONG)SubclassProc);

Windows returns "Invalid index". Has anybody an idea?

akl...@my-dejanews.com

unread,
Jul 22, 1998, 3:00:00 AM7/22/98
to
In article <35A12AE9...@urz.uni-heidelberg.de>,
Roland Richter <roland....@urz.uni-heidelberg.de> wrote:

SetWindowLong() specifically disallows attempts to hook the console window
procedure.

As far as I can tell this is sheer peevishness on Microsoft's part. I can
hook the console window just fine by directly poking the address of my window
procedure into the WND structure in USER.EXE.

They are the only way to, for example, let a hidden console process run as a
service under Windows 95 and survive a logoff.

To do this I wrote 400 lines of C and assembly code in a thunked 32/16 DLL
that used some nasty undocumented APIs known only to insiders. As far as I
know there is no other way.

Alan Klietz al...@pobox.NOSPAM.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

0 new messages