I’m rather new to C++ and I’m trying to understand the code over on this forum http://www.blizzhackers.cc/viewtopic.php?p=2483118. I’ve managed to work out most of the errors but this one’s got me stumped here’s the code from the function giving me problems.
void LoadDll(char *procName, char *dllName)
{
HMODULE hDll;
unsigned long cbtProcAddr;
hDll = LoadLibrary(dllName);
cbtProcAddr = GetProcAddress(hDll, "CBTProc"); // The error points to this line
SetWindowsHookEx(WH_CBT, cbtProcAddr, hDll, GetTargetThreadIdFromProcname(procName));
}
Change the definition of
cbtProcAddrto:The compiler is upset because you are trying to store a pointer-type value in an variable declared to hold an integer. (You may need to cast the result of
GetProcAddress()toHOOKPROC, since that function doesn’t know the actual signature of the pointed-to function, but the usage of the pointer in theSetWindowsHookEx()call implies that it is compatible with the signature of theHOOKPROCfunction-pointer type.)