I have a peculiar problem with WINDOWS 95. I am trying to subclass the window procedure of an application launched by my process. Let us assume for example that I am trying to subclass NotePad's WndProc after it is launched by my application using CreateProcess or whatever.
Ideally according to Jeffrey Richter, if a WH_GETMESSAGE hook is installed using SetWindowsHookEx on the application whose message queue you want to monitor, any message dispatched to notepads window will be routed through
my own subclass procedure. This is exactly what I did. But it seems if I install a task-specific filter as oppposed to a system-wide filter, the control NEVER comes inside the Hook filter function. Consequently the subclassing I try to do inside the filter function never gets executed.
Now if I install a system-wide filter (by giving NULL in the last parameter of SetWindowsHookEx) the control comes into the Hook filter function alright, but SetWindowLong (which I use to subclass notepad) perpetually returns ZERO. According to the documentation given for SetWindowLong in
VC++ 5.0, you must never try to subclass a window not CREATED by your process. But Richter says if a hook is installed, the DLL that containing your subclass procedure gets mapped into the address space of NotePad, so that my subclass procedure will be called within the context of Notepad. But try as I might, this is not happening. Even if I try to subclass immediately after SetWindowsHookEx (instead of inside the hook function), SetWindowLong returns ZERO.
Richter says only this method will work in Windows 95. The other methods like manipulating Registry or using CreateRemoteThread are specific to Windows NT.
PLEASE COULD ANYBODY HELP ME OUT ON THIS !!!!!!
SRA Systems Ltd