Error text:
memory_manager.cpp(23): error C2664: "HWND FindWindowW (LPCWSTR,LPCWSTR)": it is impossible to transform an argument 2 of "const char [33]" to "LPCWSTR"
Code in which there is a mistake:
Code:
bool MemoryManager::init()
{
bool success = true;
//Get a handle on the window of the game.
window_ = FindWindow(0, "Counter-Strike: Global Offensive");
if (window_ == 0)
{
cout << "Error cannot find window." << endl;
success = false;
}
else
{
//Get the process ID from the window.
GetWindowThreadProcessId(window_, &processID_);
//Get a handle on the process from the process ID.
process_ = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID_);
if (!process_)
{
cout << "Could not open the process!" << endl;
success = false;
}
else
{
//Find a handle on the module we want from the process.
clientModuleAdress_ = findModuleHandle(CLIENT_MODULE_NAME);
if (clientModuleAdress_ == 0)
{
cout << "Could not find client module adress!" << endl;
success = false;
}
else
{
engineModuleAdress_ = findModuleHandle(ENGINE_MODULE_NAME);
if (engineModuleAdress_ == 0)
{
cout << "Could not find engine module adress!" << endl;
success = false;
}
else
{
findEntityListAdress();
if (!findPlayerBaseAdresses())
{
cout << "Could not find playerbase adresses!" << endl;
success = false;
}
else
{
if (!findBoneMatrixAdresses())
{
cout << "Could not find bone matrix adresses!" << endl;
success = false;
}
else
{
if (!findClientStateAdress())
{
cout << "Could not find client state adress!" << endl;
success = false;
}
}
}
}
}
}
}
return success;
}
How to correct an error?