我需要在 windows 窗体弹出窗口中找到 textBox 的用户名和密码以及按钮。
我找到了 PopUp id,但我的 textBox 在具有相同类的元素/子项内部,我找不到我需要的特定文本框,看看你会明白的图像。
我有 8 个同班的孩子,每个孩子都有我需要的相同元素,在参数之后试图通过孩子找到它们但失败了。
int LoginPop = FindWindow(sLoginPopUpClassName, sLoginPopUpName);//found
int LoginPopForm = FindWindowEx(LoginPop, 0, sLoginPopUpClassName, sLoginPopUpName);//found
int LoginPopUserNameArea = FindWindowEx(LoginPopForm, 0, ClassName, sLoginPopUpAreaName);
> LoginPopForm have 8 child with my txtbox's
//here i tried to find my txtBox's and button with child after ,but fail.
int LoginPopUserNameArea = FindWindowEx(LoginPopForm, 7, sClassName, saName);//CtrlNotifySink
int LoginPopPasswordArea = FindWindowEx(LoginPopForm, 8, sClassName, sName);
int LoginPopButtonArea = FindWindowEx(LoginPopForm, 3, sClassName, sName);
int LoginPopTextBoxUserName = FindWindowEx(LoginPopUserNameArea, 0, sClassName, sName);
int LoginPopTextBoxPassword = FindWindowEx(LoginPopPasswordArea, 0, sClassName, sName);
int LoginPopButtonOk = FindWindowEx(LoginPopButtonArea, 0, ClassName, Name);
看这张图片: