FindWindowEx 找不到子控件的句柄,求教

baidusk baidusk 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
const int WM_GETTEXT = 0x000D;
const int WM_GETTEXTLENGTH = 0x000E;
IntPtr hwndCalc = FindWindow(null, "硬盘序列号更改工具");
// 此句???? 用Edit类名,可以找到子控件的句柄,但是那个软件里面 有三个Edit的类名 用标题 1234-5678 就找不到句柄,咋个原因呢?
IntPtr hwndThree = FindWindowEx(hwndCalc, 0, "Edit", null);
SetForegroundWindow(hwndCalc);
if (hwndCalc != IntPtr.Zero)
{
int TextLen;
TextLen = SendMessage((int)hwndThree, WM_GETTEXTLENGTH, 0, 0);
Byte[] byt = new Byte[TextLen];
SendMessage((int)hwndThree, WM_GETTEXT, TextLen + 1, byt);
string str = Encoding.Default.GetString(byt);

}



...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
baidusk
C# 111,129 成员 642,540 内容