我用的WIN32的API 如下:
IntPtr xx = FindWindow("WindowsForms10.Window.8.app.0.b7ab7b", "Form1");
if (xx != IntPtr.Zero)
{
byte[] buByte = new byte[1024];
int count = 0;
IntPtr cxx = FindWindowEx(xx, IntPtr.Zero, "WindowsForms10.EDIT.app.0.b7ab7b", null);
count = GetWindowText(cxx, buByte, 1024);
MessageBox.Show(Encoding.UTF8.GetString(buByte));
}可以找到我自己做的程序的文本框值,但是别人的却找不到
是不是 GetWindowText 这个方法错了呢?
IntPtr xx = FindWindow("WindowsForms10.Window.8.app.0.b7ab7b", "Form1");
if (xx != IntPtr.Zero)
{
byte[] buByte = new byte[1024];
int count = 0;
IntPtr cxx = FindWindowEx(xx, IntPtr.Zero, "WindowsForms10.EDIT.app.0.b7ab7b", null);
count = GetWindowText(cxx, buByte, 1024);
MessageBox.Show(Encoding.UTF8.GetString(buByte));
}可以找到我自己做的程序的文本框值,但是别人的却找不到
是不是 GetWindowText 这个方法错了呢?
string w = " ";
IntPtr ptr = Marshal.StringToHGlobalAnsi(w);
if (SendMessage(hEdit, WM_GETTEXT, 100, ptr)) Console.WriteLine(Marshal.PtrToStringAnsi(ptr));
谢谢你的回复,现在已经找到文本了,只差一点了:什么我找到文本不全,只有前几个字符?
还有 SendMessage(hEdit, WM_GETTEXT, 100, ptr) 这个 100 参数是干什么的啊?谢谢