How to hook windows in other apps ? 
Author Message
 How to hook windows in other apps ?

Hi. I am (successfully) hooking a window in my own app using
SetWindowLong. When I try however to pass to the Hook procedure the
handle of a window in a different thread (a handle to Notepad, for
instance), the hooking does not work anymore because
lngPreviousWndProc is still 0:

Public Sub Hook(hwnd As Long)

   If g_lngPreviousWndProc = 0 Then
      g_lngPreviousWndProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf
   End If
End Sub

I have tried with SetWindowsHookEx (with GWL_WNDPROC) and
UnhookWindowsHookEx but it doesn't change a thing... What am I missing
here ?


Sent via http://www.*-*-*.com/
Before you buy.

Wed, 18 Jun 1902 08:00:00 GMT  
 How to hook windows in other apps ?

See the spyworks sample at for cross-process subclassing.


Wed, 18 Jun 1902 08:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. hook into another app's window

2. Hooking messages from a Child Window in another App

3. Windows hook and control hook

4. Hook (Sending Message from a Visual C++ App To a Visual Basic App)

5. Making databases R/W to my app, R/O to others

6. Making the call stack window (and others) resizable?

7. make a window force others below

8. Keep Window on top of ALL OTHERS in OS.

9. Help - trying to hook an app to the intranet

10. Hooking onto an app to get internal messages

11. Hook menu into another app

12. Mhcallback - Keyboard hook and Mouse hook , HOW!


Powered by phpBB® Forum Software