C++: How to set a new wndProc for a console application?

后端 未结 2 899
一生所求
一生所求 2021-01-11 23:48

If I have a console application with a handle to it set up like so;

HWND hWnd = GetConsoleWindow();

Then how do I set up a new wndProc for

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 00:22

    While the impression is that console window belongs to your process (like other window), it is in fact hosted by CSRSS system process and its WndProc is there. This makes you unable to subclass the window and provide your own WndProc living in your process.

    Some related reading:

    • The process that is in charge of displaying the GUI windows in which consoles are presented is... CSRSS
    • SetWindowsHookEx with WH_KEYBOARD doesn't work for me, what do I wrong?
    • Subclassing XP Console Window

提交回复
热议问题