// <summary>
/// Get text box control
// </summary>
/// <param Name= "hwnd" > Text Box parent window </param>
// <param name= "text" > text box text, NULL to search all </param>
/// <param name= "ilevel" > Parent window on the first few text boxes </param>
/// <returns> text box handle </returns>
Private IntPtr Gettextedit (IntPtr hwnd,string text, int ilevel)
{
IntPtr ieditor = IntPtr.Zero;
IntPtr ICode = IntPtr.Zero;
if (hwnd! = IntPtr.Zero)
{
for (int i = 0; i < ilevel; i++)
{
ICode = Windowsapi.findwindowex (hwnd, ICode,"Windowsforms10.window.b.app.0.bf7771_r13_ad1", "");
if (ICode = = IntPtr.Zero)
Break
}
if (iCode! = IntPtr.Zero)
Ieditor = Windowsapi.findwindowex (ICode, IntPtr.Zero,"Windowsforms10.edit.app.0.bf7771_r13_ad1", text);
}
return ieditor;
}
Description
The "Windowsforms10.edit.app.0.bf7771_r13_ad1" text box type, which can be viewed through the Spy + + tool, such as
The text box has a parent class, such as "Windowsforms10.edit.app.0.bf7771_r13_ad1" in the code, which is the parent class type of the text box , to find the parent class of the first text box. The current text box is then looked up from the parent class.
Original C # applies the WINDOWSAPI implementation lookup (FindWindowEx) text box (TextBox, TextEdit).