Unzip dssubcls.dll in to the same folder as your script. You can then use it to "subclass" any other window. My example in Notepad:
AutoIt
#include <WindowsConstants.au3> #include <GuiListbox.au3> Global $hList _Main() Exit Func _Main() Local $hGUI = GUICreate("Subclass", 400, 400) Local $cList = GUICtrlCreateList("", 8, 8, 384, 384, BitOR($WS_BORDER, $WS_VSCROLL)) GUISetState() $hList = GUICtrlGetHandle($cList) Local $hDSSUBCLS = DllOpen("dssubcls.dll") Run("Notepad.exe") WinWait("[CLASS:Notepad]") Local $hNotepad = WinGetHandle("[CLASS:Notepad]") Local $hCallback = DllCallbackRegister("_MyCallback", "long", "long;long;long") Local $aRet = DllCall($hDSSUBCLS, "long", "SubClass", "hwnd", $hNotepad, "ptr", DllCallbackGetPtr($hCallback), "long", 0, "long", 0, "long", 0, "long", 1) $aRet = DllCall($hDSSUBCLS, "long", "UseSendMessage", "long", 1) While GUIGetMsg() <> -3 Sleep(100) WEnd DllClose($hDSSUBCLS) GUIDelete() EndFunc ;==>_Main Func _MyCallback($uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_COMMAND If $lParam = 0 Then _GUICtrlListBox_AddString($hList, "WM_COMMAND(" & $wParam & "," & $lParam & ")") EndIf EndSwitch Return 0 EndFunc ;==>_MyCallback
Selecting a menu item from Notepad puts a message in to the list box. Should work for other windows and applications too although I'm not sure what will happen under Vista/Windows7 and whether you're allowed to do this. Note that the "hooked" application does tend to run a little slower and I suspect that's because it's firing messages at _MyCallback() which is taking too long to respond. However, I'm not certain about this.
More information about the "SubClass" function can be found in the TXT file that's also in the package.
Hope this helps. Have fun.
WBD





