Okay, I'm making a trainer for Quake 2, and everything is working, exept I can't get the HWND of the Quake 2 window. I have this:
1 2 3 4 5 6 7 8 9 10
hwnd = FindWindow(NULL,(LPCWSTR)"Quake 2"); // Yes, the name of the window is "Quake 2", case for case.
if (hwnd != 0)
{
cout << " You caught the window!" << endl;
}
else
{
cout << "open the freakin game..." << endl;
}
And the output is always this: "open the freakin game..."
I looked up the FindWindow function, and I came across a lot of arguments pertaining to its use.
Can anyone help me get the handle of the Quake 2 window? I don't care whether you use Findwindow or not...
It could also be that he is doing a cast to (LPCWSTR).
Try it without the cast, and if that doesn't work try it like this hwnd = FindWindow(NULL, _T("Quake 2") );
@guestgulkan
I tried doing it without a cast, and I got the error that made me use a cast in the first place: "Cannot convert parameter 2 from const char[8] to LPCWSTR"
Then I tried your method and got '_T': identifier not found. Sounds like I'm missing the library?
@Duoas
I'm still learning C++ and don't know how to use either function mentioned. I tried googling them, and couldn't find an understandable definition or use for each. Can you please expain how to use them? (an example would be greatly appreciated)