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

后端 未结 2 858
一生所求
一生所求 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

    First of all SetWindowLong is superseded by SetWindowLongPtr, you should use that function.

    Are you trying to change the WNDPROC of your own console window or another process?

    From the MSDN docs :

    GWL_WNDPROC -4 Sets a new address for the window procedure. You cannot change this attribute if the window does not belong to the same process as the calling thread.

提交回复
热议问题