API 函数 FindWindowEx 
在多个控件中取其中指定控件的句柄?
应该怎么做?即比如:
现在一个窗体"Form1"
窗体内有:TextBox1,TextBox2,TextBox3等多个控件,
我现在想得到TextBox2的句柄,或内容???请尽量给完整的代码! (VB.net , C#  ,VB  代码都行!)感谢在线等!!

解决方案 »

  1.   

    string lpszClass = "EditComponent"; //需要查找的子窗口的类名,也就是输入框  
    FindWindowEx(ParenthWnd,EdithWnd,lpszClass,"");  
    在spy++里看看IntPtr hwndCalc = FindWindow(null, ""); 
                if (hwndCalc != IntPtr.Zero)
                {
                   IntPtr hwndThree = FindWindowEx(hwndCalc, 0, null, ""); //获取句柄
                    if (hwndThree != IntPtr.Zero)
                    {
                        StringBuilder strB = new StringBuilder(100);
                        SendMessage(hwndThree, WM_GETTEXT, new IntPtr(255), strB);
                        string a = strB.ToString().Trim();
                        MessageBox.Show(a);
                    }
                }