Original C # applies the WINDOWSAPI implementation lookup (FindWindowEx) text box (TextBox, TextEdit).

Source: Internet
Author: User

// <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).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.