Subclassing windows of other processes
-
Yes, but only by using a global hook. There is information on MSDN about how to do this. Basically you set a global hook (usually a WH_CBT hook) from inside a DLL and when the hook function is called by Windows for a particular process, your DLL is loaded into the address space of that process. You can then subclass whichever windows in that process you want. Usually, you set a hook that activates whenever the HCBT_CREATEWND code is passed (a window is created), but if the window is already created, you may never get the opportunity to subclass it. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Yes, but only by using a global hook. There is information on MSDN about how to do this. Basically you set a global hook (usually a WH_CBT hook) from inside a DLL and when the hook function is called by Windows for a particular process, your DLL is loaded into the address space of that process. You can then subclass whichever windows in that process you want. Usually, you set a hook that activates whenever the HCBT_CREATEWND code is passed (a window is created), but if the window is already created, you may never get the opportunity to subclass it. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
You're welcome :) Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Yes, but only by using a global hook. There is information on MSDN about how to do this. Basically you set a global hook (usually a WH_CBT hook) from inside a DLL and when the hook function is called by Windows for a particular process, your DLL is loaded into the address space of that process. You can then subclass whichever windows in that process you want. Usually, you set a hook that activates whenever the HCBT_CREATEWND code is passed (a window is created), but if the window is already created, you may never get the opportunity to subclass it. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"Am not sure, but won't using
WH_CALLWNDPROC
orWH_CALLWNDPROCRET
hooks to obtain the handle of the window or its controls after creation then usingSetWindowLong()
to set theGWL_WNDPROC
property could do the job of subclassing the window after its creation? -
Am not sure, but won't using
WH_CALLWNDPROC
orWH_CALLWNDPROCRET
hooks to obtain the handle of the window or its controls after creation then usingSetWindowLong()
to set theGWL_WNDPROC
property could do the job of subclassing the window after its creation?WH_CALLWNDPROC hooks are called from the context of the process that calls
SendMessage()
, not the one that receives the message. As long as a message is sent by the same process as the one you're wanting to subclass the window in, it should be OK. These will work, but these hook functions are called for every message sent to every window. They substantially slow down the system and are not recommended unless absolutely necessary. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"