windows - findwindow doesn't work c++ -
so im trying create camo unlocker have never had trouble getting process id through findwindow
but im trying find black ops 2's proc id window name doesn't work
call of duty®: black ops ii
code:
#include <iostream> #include <windows.h> #include <tchar.h> using namespace std; int main(){ hwnd hwnd = findwindow(0, _t("call of duty®: black ops ii - multiplayer")); if(hwnd){ cout << "window found" << endl; } return 0; }
findwindow
works correctly. possible causes problem are:
you have encoding error. should use unicode api:
hwnd hwnd = findwindoww(null, l"call of duty®: black ops ii - multiplayer");
there no top level window window text. use tool spy++ check that.
you should make sure read documentation carefully. states following:
if function fails, return value null. extended error information, call getlasterror.
you should says , call getlasterror
in event of failure.
Comments
Post a Comment