#ifndef WINVER
#define WINVER 0x0400
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif//这几行放在#include<Windows.h>的前面啊 我晕
#include<Windows.h>
#include <TCHAR.H>
/*#pragma data_seg("MySec")
#pragma data_seg()*/
HWND g_hwnd=NULL;
HHOOK g_hKeyBoard=NULL;
HINSTANCE handle=NULL;
switch( ulReason)
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
handle= hInstance;
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
LRESULT CALLBACK LowLevelKeyboardProc( int nCode,
WPARAM wParam,
LPARAM lParam
)
{
KBDLLHOOKSTRUCT* kb= (KBDLLHOOKSTRUCT *)lParam;
if(kb->vkCode==VK_LWIN)
return TRUE;
else
return CallNextHookEx(g_hKeyBoard,nCode,wParam,lParam);
}
g_hwnd=wnd;
g_hKeyBoard=SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,handle,0);
}
#define WINVER 0x0400
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif//这几行放在#include<Windows.h>的前面啊 我晕
#include<Windows.h>
#include <TCHAR.H>
/*#pragma data_seg("MySec")
#pragma data_seg()*/
HWND g_hwnd=NULL;
HHOOK g_hKeyBoard=NULL;
HINSTANCE handle=NULL;
BOOL WINAPI DllMain(HINSTANCE hInstance,ULONG ulReason,LPVOID Reserved)
{switch( ulReason)
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
handle= hInstance;
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
LRESULT CALLBACK LowLevelKeyboardProc( int nCode,
WPARAM wParam,
LPARAM lParam
)
{
KBDLLHOOKSTRUCT* kb= (KBDLLHOOKSTRUCT *)lParam;
if(kb->vkCode==VK_LWIN)
return TRUE;
else
return CallNextHookEx(g_hKeyBoard,nCode,wParam,lParam);
}
void SetHookLL(HWND wnd)
{g_hwnd=wnd;
g_hKeyBoard=SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,handle,0);
}