error c2065

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am new to windows programming, I was trying to compile the following code and it gives me the following errors:<br/>
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(14) : error C2065: KeyboardProc : undeclared identifier<br/>
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(22) : error C2373: KeyboardProc : redefinition; different type modifiers<br/>
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(30) : error C2065: GetkeyState : undeclared identifier<br/>
Error executing cl.exe.<br/>
<br/>
<br/>
<br/>
/* CODE */<br/>
#include<windows.h><br/>
<br/>
static HHOOK hkb=NULL;<br/>
HANDLE h;<br/>
<br/>
BOOL __stdcall DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)<br/>
{<br/>
h=hModule;<br/>
return TRUE;<br/>
}<br/>
<br/>
BOOL __declspec(dllexport)installhook()<br/>
{<br/>
hkb=SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, (HINSTANCE)h,0);<br/>
if(hkb==NULL)<br/>
return FALSE;<br/>
<br/>
return TRUE;<br/>
}<br/>
<br/>
LRESULT __declspec(dllexport)__stdcall KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)<br/>
{<br/>
short int state;<br/>
<br/>
if(nCode<0)<br/>
return CallNextHookEx(hkb, nCode, wParam, lParam);<br/>
<br/>
if((nCode==HC_ACTION)&&((DWORD)lParam&0*40000000))<br/>
{<br/>
state=GetkeyState(VK_CAPITAL);<br/>
if((state&1)==0)<br/>
{<br/>
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY,0);<br/>
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0);<br/>
}<br/>
}<br/>
return CallNextHookEx(hkb, nCode, wParam, lParam);<br/>
}<br/>
<br/>
BOOL __declspec(dllexport) removehook()<br/>
{<br/>
return UnhookWindowsHookEx(hkb);<br/>
}<br/>
<br/>
<br/>
<br/>
Can anyone please help me...

View the full article
 
Back
Top