المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Read in Cyrillic, Arabic, Japanese with GetWindowText not working



C# Programming
01-12-2010, 12:00 PM
I am trying to read text from an external application using GetWindowText. It works just fine for all of the other ********s in the software I am trying to read from. (German, English, French) However, it fails when it tries to read in Cyrillic (Russian), Arabic, Japanese. All it gets is a bunch of question marks. Here is the code that I am using.

[DllImport("User32.dll", CharSet = CharSet.Unicode)]
public static extern Int32 GetWindowText(int hWnd, StringBuilder s, int nMaxCount);


//Form Builder is a StringBuilder
Win32.GetWindowText(hWnd, formDetails, 512);

When I display the text using a textbox is is merely a bunch of "?????? ????? ?? ???????".
I know it has nothing to do with the textboxes inability to display those ********s because if I directly drop a string of Cyrillic into a variable in C# and display it in the box, it display just fine. What am I doing wrong?

-Elmernite