16,472
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#include <stdio.h>
HHOOK g_hKeyBoard;
HWND g_hWnd=NULL;
LRESULT CALLBACK KeyboardProc(
int code, // hook code
WPARAM wParam, // virtual-key code
LPARAM lParam // keystroke-message information
)
{
if(VK_F12==wParam)
{
ShowWindow(g_hWnd,SW_RESTORE);
}
else
{
ShowWindow(g_hWnd,SW_MINIMIZE);
}
UpdateWindow(g_hWnd);
return 1;
}
void SetHook(HWND hWnd)
{
g_hWnd=hWnd;
g_hKeyBoard=SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,GetModuleHandle("hookdll"),0);
}
#pragma data_seg("HOOKDLLSHARE")
HHOOK g_hKeyBoard;
HWND g_hWnd=NULL;
#pragma data_seg()
#pragma comment(linker,"/SECTION:HOOKDLLSHARE,RWS")