日期:2014-05-17 浏览次数:20780 次
IntPtr ParenthWnd = new IntPtr(0);
IntPtr EdithWnd = new IntPtr(0);
IntPtr EdithWnd2 = new IntPtr(0);
//查到窗体,得到整个窗体
ParenthWnd = FindWindow(null,"TeamViewer");
//FindChildClassHwnd(hwndParent, IntPtr.Zero);
//判断这个窗体是否有效
if (!ParenthWnd.Equals(IntPtr.Zero))
{
MessageBox.Show( "对话框存在 "); }
else
{MessageBox.Show( "对话框不存存在 ");}
//得到User Name这个子窗体,并设置其内容
EdithWnd = FindWindowEx(ParenthWnd, EdithWnd, "Edit", "");
EdithWnd2 = FindWindowEx(ParenthWnd, EdithWnd, "Edit", null);//获取EDIT句柄 密码
if (!EdithWnd.Equals(IntPtr.Zero))
{
StringBuilder sb = new StringBuilder(1024);
SendMessage(EdithWnd, WM_GETTEXT, sb.Capacity, sb);
MessageBox.Show(sb.ToString());
SendMessage(EdithWnd2, WM_GETTEXT, sb.Capacity, sb);
&nbs