获取窗体的搜有控件句柄
如何获取该窗体上盘符地址栏,和搜索栏控件的句柄,并发消息去改变盘符路径和搜索的文件值const int WM_SETTEXT = 0x000C;
const int WM_LBUTTONDOWN = 0x0201;
const int WM_LBUTTONUP = 0x0202;
const int WM_CLOSE = 0x0010;
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam);
[DllImport("User32.dll ")]
public static extern IntPtr FindWindowEx(IntPtr parent, IntPtr childe, string strclass, string FrmText);
private void button1_Click(object sender, EventArgs e)
{
IntPtr hwnd = FindWindow("CabinetWClass", null);
IntPtr htextbox = FindWindowEx(hwnd, IntPtr.Zero, "EDIT", null);
SendMessage(htextbox, WM_SETTEXT, IntPtr.Zero, "name");
IntPtr hbutton = FindWindowEx(hwnd, IntPtr.Zero, "BUTTON", null);
SendMessage(hbutton, WM_LBUTTONDOWN, IntPtr.Zero, null);
SendMessage(hbutton, WM_LBUTTONUP, IntPtr.Zero, null);
}
这样为什么获取不到,应该如何获取 窗体 控件 句柄
补充:.NET技术 , C#