dll问题1
wwwaj 2002-05-17 09:25:34 void WINAPI InstallLaucher()
{
CFileException e;
char* pFileName = "D:\\chap19\\work\\test.dat";
if( !fp.Open( pFileName, CFile::modeCreate | CFile::modeWrite, &e ) )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}
Hook=(HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)LauncherHook,theApp.m_hInstance,0);
}
LRESULT CALLBACK LauncherHook(int nCode,WORD wParam,DWORD lParam)
{
LRESULT Result=CallNextHookEx(Hook,nCode,wParam,lParam);
char aa[1];
aa[0]=(char)wParam;
if(nCode==HC_ACTION)
{
if(lParam & 0x80000000)
{
fp.Write(aa,1);
Result=0;
};
};
return Result;
}
以上是以动态库所用的两函数,主程序调用InstallLaucher, 钩键盘,可只能钩本进程的,其他程序的击键,不能钩住,不知为何,能帮一下吗?谢谢!