M
msnews.micorsoft.com
i want to receive a message when a window was activated.
I use the WH_CBT type hook to process,the code is following:
LRESULT CALLBACK CBTProc(int nCode,WPARAM wParam, LPARAM lParam)
{
HWND hWnd;
if(nCode < 0)
return CallNextHookEk(hHook,nCode,wParam,lParam);
if(nCode == HCBT_ACTIVATE)
{
counter++;
:ostMessage(hparentWin,USER_MESSAGE_1,wParam,lParam);//send a user
message to my application's main window
}
return CallNextHookEx(hHook,nCode,wParam,lParam);
}
But the code can not run rightly.
who can help me, it would be better to supply the code.
I use the WH_CBT type hook to process,the code is following:
LRESULT CALLBACK CBTProc(int nCode,WPARAM wParam, LPARAM lParam)
{
HWND hWnd;
if(nCode < 0)
return CallNextHookEk(hHook,nCode,wParam,lParam);
if(nCode == HCBT_ACTIVATE)
{
counter++;
:ostMessage(hparentWin,USER_MESSAGE_1,wParam,lParam);//send a user
message to my application's main window
}
return CallNextHookEx(hHook,nCode,wParam,lParam);
}
But the code can not run rightly.
who can help me, it would be better to supply the code.