LS, I am using the FindWindow method in a C # application to get a window handle from a web browser
[DllImport("user32.dll")] public static extern int FindWindow(string lpClassName, string lpWindowName );
it works well when the window title does not contain utf characters, as here:
string caption1 = "pinvoke.net: findwindow (user32) - Google Chrome"; int hwnd = FindWindow(null, caption1);
but it fails if utf characters are present in the window title:
string caption2 = "Słownik języka polskiego - Google Chrome"; int hwnd2 = FindWindow(null, caption2);
eg. hwnd == 0
Could you provide me any suggestion on how to handle a browser window containing utf-8 characters in a C # application. Thanks in advance.
ps I already saw a comment about using FindWindow with utf in C ++ saying: "You can explicitly use the Unicode version of the HWND API windowHnd = FindWindowW (NULL, L" Minesweeper "); but I still don't know how to do this in c #
source share