I have posted here entier code cuz myb I made bad struct or put some functions on wrong place . But It doesnt make sens for me why I am getting Error on LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) ,and it doesnt make sens to put ; after it. If someone have time to check code and give me advice how to fix this or realize this on easier way ,I will be very thankful.
int main()
{
int togler;
int g;
HHOOK MouseHook;
HHOOK hhkLowLevelKybd;
bool SupressMouseHook = false;
bool click = false;
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
BOOL eatMouseStroke2 = false;
if (!SupressMouseHook) {
BOOL eatMouseStroke = false;
if (togler == 1) {
if (wParam == WM_LBUTTONDOWN) {
click = true;
}
else if (wParam == WM_LBUTTONUP) {
click = false;
}
}
return(eatMouseStroke ? 1 : CallNextHookEx(NULL, nCode, wParam, lParam));
}
else {
BOOL eatMouseStroke = false;
return(eatMouseStroke ? 1 : CallNextHookEx(NULL, nCode, wParam, lParam));
}
return(eatMouseStroke2 ? 1 : CallNextHookEx(NULL, nCode, wParam, lParam));
}
MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, GetModuleHandle(NULL), 0);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)clicker, NULL, NULL, NULL);
}
You should move MouseHookProc
definition outside of main
. C++ does not allow function definitions inside of other functions.
Among other things, (LPTHREAD_START_ROUTINE)clicker
is also wrong, there is no need to perform cast here, instead clicker
function must have correct signature, void down();
is actually a function declaration, not invocation.