在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
声明部分: const int WM_GETTEXT = 0x000D; const int WM_GETTEXTLENGTH = 0x000E; [DllImport("user32.dll", EntryPoint = "SendMessageA")] public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, Byte[] lParam); [DllImport("user32.dll", EntryPoint="SendMessageA")] public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
函数部分: IntPtr mwh = FindMainWindowHandle("窗口名称", 100, 25); //主窗口句柄 IntPtr HwndStatue = FindWindowEx(mwh, IntPtr.Zero, "Edit", null); //文本框句柄 if (HwndStatue != IntPtr.Zero) { int TextLen; TextLen = SendMessage(HwndStatue, WM_GETTEXTLENGTH, 0, 0); Byte[] byt = new Byte[TextLen]; SendMessage(HwndStatue, WM_GETTEXT, TextLen + 1, byt); string str = Encoding.Default.GetString(byt); }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论