LRESULT
WINAPI GetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
// AfxMessageBox("12345");
if(g_hHook == NULL)
{ // Read the data from the shared resources
DWORD dwData = 0, dwSize = sizeof(DWORD);
g_obIPC.Lock();
g_obIPC.OpenIPCMMF();
g_obIPC.ReadIPCMMF((LPBYTE)&dwData, dwSize);
g_obIPC.Unlock();
g_hHook = (HHOOK)dwData;
}
if(code>=0)
{
//if(wParam==WM_SCANPWD)
{
CString strTemp;
strTemp="catch the Windows Message\n";
MSG *msg=(MSG *)lParam;
HWND hWnd, hWndPwdDlg;
hWnd=(HWND)msg->wParam ;
hWndPwdDlg=(HWND)msg->lParam;
//MessageBox(hWndPwdDlg,strTemp,"tip",MB_OK);
char szBuffer[100];
SendMessage(hWnd,WM_GETTEXT,sizeof(szBuffer),(LPARAM)szBuffer);
//MessageBox(hWndPwdDlg,"asdf","dafasdf",MB_OK);
COPYDATASTRUCT cds;
cds.cbData=sizeof(cds);
cds.dwData=(DWORD)hWnd;
cds.lpData =szBuffer;
SendMessage(hWndPwdDlg, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds);
//MessageBox(hWndPwdDlg,"asdf","dafasdf",MB_OK);
//TRACE("aljflajfl;ajkfla\n");
}
}
return CallNextHookEx(g_hHook,code,wParam,lParam);
}