15,471
社区成员
发帖
与我相关
我的任务
分享
LRESULT CALLBACK shellhookproc(int nCode, WPARAM wParam, LPARAM lParam)
{
wfstream ofile;
LPTSTR temp=_T("temp");
LPTSTR lang=_T("lang");
DWORD proid;
switch (nCode)
{
case HSHELL_WINDOWACTIVATED:
ofile.open("d:/out.txt",ios::app);
GetWindowModuleFileName(NULL,temp,255);
proid = GetWindowThreadProcessId(hWnd,&proid);
ImmGetDescription(GetKeyboardLayout(proid),lang,255);
ofile<<"HSHELL_WINDOWACTIVATED\t"<<temp<<"\t"<<lang<<endl;
ofile.flush();
ofile.close();
break;
case HSHELL_LANGUAGE:
ofile.open("d:/out.txt",ios::app);
GetWindowModuleFileName(NULL,temp,255);
proid = GetWindowThreadProcessId(hWnd,&proid);
ImmGetDescription(GetKeyboardLayout(proid),lang,255);
ofile<<"HSHELL_LANGUAGE\t"<<temp<<"\t"<<lang<<endl;
ofile.flush();
ofile.close();
break;
default:
break;
}
return CallNextHookEx(shellhook, nCode, wParam, lParam);
}