In my Win32 application, a child window is created by a third party SDK.The Window creation process is transparent and I cannot associate a WndProc method with the child Window. I want to be able to capture child window messages in parent window. How can I do this? Any help would be highly appreciated.
Asked
Active
Viewed 6,187 times
8
-
Have you tried CWnd::SubclassWindow? – Mark Ransom Jul 12 '11 at 22:15
-
2You can trivially associate your own window proc with `SetWindowLong` and `GWL_WNDPROC`. You can do this for each and every window in your process. See this: http://msdn.microsoft.com/en-us/library/ms633570(v=VS.85).aspx#subclassing_window – David Heffernan Jul 12 '11 at 22:15
1 Answers
4
Have you looked at SetWindowsHookEx? Or if that seems like overkill you could probably just use SetWindowLong with GWL_WNDPROC
and define your own custom WinProc then forward to the child window.
There is a pretty good article on MSDN about it.

Brandon Moretz
- 7,512
- 3
- 33
- 43
-
Hi Again, does this solution works for multi-threaded application? In my application Parent window is in main thread while child window is in separate thread. I have tried subclassing but it's not working. – Farooq Zaman Jul 13 '11 at 02:06