Official eMule-Board: Error C2065 - Official eMule-Board

Jump to content


Page 1 of 1

Error C2065

#1 User is offline   RSCjuice 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-July 11

Posted 10 July 2011 - 10:17 AM

I am new to windows programming, I was trying to compile the following code and it gives me the following errors:
C:\Program Files\Microsoft Visual Studio\MyProjects\hook\hook.cpp(14) : error C2065: 'KeyboardProc' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\hook\hook.cpp(22) : error C2373: 'KeyboardProc' : redefinition; different type modifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\hook\hook.cpp(30) : error C2065: 'GetkeyState' : undeclared identifier
Error executing cl.exe.



/* CODE */
#include<windows.h>

static HHOOK hkb=NULL;
HANDLE h;

BOOL __stdcall DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
h=hModule;
return TRUE;
}

BOOL __declspec(dllexport)installhook()
{
hkb=SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, (HINSTANCE)h,0);
if(hkb==NULL)
return FALSE;

return TRUE;
}

LRESULT __declspec(dllexport)__stdcall KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
short int state;

if(nCode<0)
return CallNextHookEx(hkb, nCode, wParam, lParam);

if((nCode==HC_ACTION)&&((DWORD)lParam&0*40000000))
{
state=GetkeyState(VK_CAPITAL);
if((state&1)==0)
{
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0);
}
}
return CallNextHookEx(hkb, nCode, wParam, lParam);
}

BOOL __declspec(dllexport) removehook()
{
return UnhookWindowsHookEx(hkb);
}



Can anyone please help me...
0

#2 User is offline   xilolee 

  • eMule 0.50b BETA1 user
  • PipPipPipPipPipPipPip
  • Group: Italian Moderators
  • Posts: 7983
  • Joined: 20-August 08

Posted 10 July 2011 - 09:56 PM

I am very new too, but if you look at the errors the function "BOOL __declspec(dllexport)installhook()" contains "KeyboardProc" that is defined later in "LRESULT __declspec(dllexport)__stdcall KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)".
Try to put "LRESULT __declspec(dllexport)__stdcall KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)" before "BOOL __declspec(dllexport)installhook()".

This post has been edited by xilolee: 10 July 2011 - 09:56 PM

INCONCEIVABLE! - You keep using that word. I do not think it means what you think it means.
come ottenere aiuto italian guides - guide della sezione italiana
italian support - sezione italiana scaricare la lista server
ottenere id alto impostare le porte nel router
recuperare file corrotti i filtri ip
Sembra talco ma non č serve a darti l'allegrIa! Se lo lanci e poi lo respiri ti dā subito l'allegrIa! Posted Image
0

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users