自己做的个DLL叫“CF自动卡BUG”,C++的,我加载了无效,怎么滴,各位大虾看看,那个keybd_event无效额
#include <windows.h>
HWND hWnd;
HHOOK g;
void c();
void CALLBACK p(HWND hWnd,UINT nMsg,UINT nTimerid,DWORD dwTime)
{
switch(nMsg)
{
case WM_TIMER:c();break;
}
}
void c2()
{
keybd_event(0x11,0,0,0);
keybd_event(0x20,0,0,0);
Sleep(700);
keybd_event(0x20,0,KEYEVENTF_KEYUP,0);
Sleep(700);
keybd_event(0x57,0,0,0);
Sleep(300);
keybd_event(0x57,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x53,0,0,0);
Sleep(300);
keybd_event(0x53,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x57,0,0,0);
Sleep(800);
keybd_event(0x11,0,KEYEVENTF_KEYUP,0);
keybd_event(0x11,0,0,0);
keybd_event(0x11,0,KEYEVENTF_KEYUP,0);
keybd_event(0x57,0,KEYEVENTF_KEYUP,0);
}
void c1()
{
keybd_event(0x11,0,0,0);
keybd_event(0x20,0,0,0);
Sleep(700);
keybd_event(0x20,0,KEYEVENTF_KEYUP,0);
Sleep(700);
keybd_event(0x57,0,0,0);
Sleep(300);
keybd_event(0x57,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x53,0,0,0);
Sleep(300);
keybd_event(0x53,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x57,0,0,0);
Sleep(300);
keybd_event(0x57,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x53,0,0,0);
Sleep(300);
keybd_event(0x53,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event(0x57,0,0,0);
Sleep(800);
keybd_event(0x11,0,KEYEVENTF_KEYUP,0);
keybd_event(0x11,0,0,0);
keybd_event(0x11,0,KEYEVENTF_KEYUP,0);
keybd_event(0x57,0,KEYEVENTF_KEYUP,0);
}
LRESULT CALLBACK b(int code,WPARAM wParam,LPARAM lParam)
{
switch(wParam)
{
case VK_F1:c1();break;
case VK_F2:c2();break;
}
return CallNextHookEx(g,code,wParam,lParam);
}
BOOL WINAPI DllMain(
HANDLE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved
)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
{
SetTimer(NULL,0,800,TIMERPROC(p));
DWORD k=GetWindowThreadProcessId(hWnd,NULL);
g=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)b,GetModuleHandle("CF自动卡BUG.dll"),k);
break;
}
}
return 1;
}
void c()
{
hWnd=FindWindow(NULL,"CrossFire");
if(hWnd)
{
KillTimer(hWnd,0);
}
}