Even with latest CVS, I require this patch for SetWindowsHookEx to work at all:
diff -u -r1.2 GuiTest.xs
--- GuiTest.xs 1 Oct 2008 11:27:45 -0000 1.2
+++ GuiTest.xs 8 Oct 2008 10:15:38 -0000
@@ -315,6 +315,10 @@
HHOOK SetHook(HWND hWnd, UINT &uMsg, char *lpMsgId)
{
g_hWnd = hWnd;
+ if (! g_hDLL) {
+ g_hDLL=GetModuleHandle("GuiTest.dll");
+ fprintf(stderr,"had to get module handle: %x\n",g_hDLL);
+ }
// Give up rest of time slice, so g_hHook assignment and
// SetWindowsHook will process.
Otherwise g_hDLL is always NULL, and the hook fails.
However even with that patch, the explorer.exe now hangs when the hook is made on a SysListView32 file explorer view.
Debugging by means of carefully placed tight loops (counts to a few trillion) to make CPU usage go to 100% shows that the HookProc is never entered.
Does anybody else have windows hooking working?
GetLVItem without hooking
The attached patch to latest CVS on 9 Oct 2008, allows GetLVItemText to work without needing to hook the wndproc.
Which is good, as hooking isn't working for me - maybe a cygwin problem.
See bug: 1192980
I've taken his work and written a helper macro file RSNDMSG.h (remote send message) and also patched GuiTest.xs so I can now control the listview32 controls without using hookproc.
I'll attach a patch next
Manipulate list view controls without a hook