You use ANSI strings with what looks like a Unicode version of FindWindow .
Many Win32 functions are actually a pair of functions and a macro. For example, FindWindow is defined like this:
HWND WINAPI FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName); HWND WINAPI FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName); #if (UNICODE) # define FindWindow FindWindowW #else # define FindWindow FindWindowA #endif
Try explicitly calling FindWindowA or using wide strings, for example:
HWND hwnd = FindWindow(L"iTunes", L"iTunes");
source share