Hi,
I'm trying to hook into firefox.exe to capture a few messages. Which seems to work fine (messages are received), however when I give the window focus (by clicking on it in the task bar) Firefox crashes. It always happens right after the hook receives the WM_WINDOWPOSCHANGING message.
My DLL code is:
Code:
FIREFOXDLL_API LRESULT GetMsgProc(
int code,
WPARAM wParam,
LPARAM lParam
)
{
return CallNextHookEx(0, code, wParam, lParam);
}
I've previously had some file writing code here, to output the message data, which is how I know it always crashes after the WM_WINDOWPOSCHANGING message.
The main program has the following function:
Code:
// Called using EnumWindows(enumMainWindows, processID);
// hkprcSysMsg and hinstDLL are correctly initialized
BOOL CALLBACK enumMainWindows(HWND hwnd, LPARAM lParam)
{
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
if (pid == lParam)
{
DWORD tid = GetWindowThreadProcessId(hwnd, NULL);
SetWindowsHookEx(
WH_CALLWNDPROC,
hkprcSysMsg,
hinstDLL,
tid);
return false;
}
return true;
}
If anyone could share any insight they might have regarding what can be causing this, it would be much appreciated.