The code is like this:
class CAtMSNWnd
ublic CWindowImpl<CAtMSNWnd>
{
public :
CAtMSNWnd(){};
virtual ~CAtMSNWnd(){};
public :
BEGIN_MSG_MAP(CAtMSNWnd)
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
END_MSG_MAP()
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};
SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)MSNMsgFilter, _Module.GetModuleInstance(), GetWindowThreadProcessId(hWnd,&pid) ); //hWnd is MSN main window
CAtMSNWnd* g_pMSNWnd = NULL;
LRESULT CALLBACK __stdcall MSNMsgFilter(int nCode ,WPARAM wParam,LPARAM lParam)
{
...//following code will only be enterred once
g_pMSNWnd = new CAtMSNWnd();
if(!g_pMSNWnd)
return FALSE;
g_pMSNWnd->Create(GetDesktopWindow(), rc, "my test window", WS_POPUP, 0, 0); //Crashed at this place
...
}
Is there any wrong?