User32.dll如何从Window获取所有元素

时间:2014-05-13 12:25:49

标签: c# winforms sendmessage postmessage user32

你好发布post / sendMessage,插入用户/密码而不是单击应用程序按钮。并且....

我连接到apllication后,我有Windows信息,好到现在一切都很好。 我的问题是我有一个带有文件夹的窗口(不像之前的textBoxs,非常容易使用的按钮),并且在每个文件夹的一侧有一个文件,我需要选择并按回车。< / p>

我想这样做:

1.查找此表格

2.按WM_KEYUP / WM_KEYDown(我想这样PostMessage(currChild, WM_KEYUP, 0, 0);

3.要知道每个文件夹(名称),如果需要,请按Enter键

4.然后转到子文件逐个选择并按Enter

好的我在第2步,不知道该怎么做

我的代码

if (connected)
 {

 prevChild = 0;

    intWhdr = FindWindow("WindowsForms10.Window.8.app.0.33c0d9d","Finance");//Main Window
    currChild = FindWindowEx(intWhdr, prevChild, "WindowsForms10.SysTreeView32.app.0.33c0d9d", "TreeView");//This my Window with folders
    currChild = FindWindowEx(intWhdr, prevChild,"WindowsForms10.SysTreeView32.app.0.33c0d9d", "");

                                do
                                {
    currChild = FindWindowEx(intWhdr, prevChild, "WindowsForms10.SysTreeView32.app.0.33c0d9d", "TreeView");
            currChild = FindWindowEx(intWhdr, prevChild, null, null);
       if (currChild != 0)//here i trying to find my folders
      {
  byte[] buffer = new byte[256];
  string text = null;
  int rs = SendMessage(currChild, WM_GETTEXT, 256, buffer);

text = System.Text.Encoding.Unicode.GetString(buffer);
text = text.Replace("\0", "");//Trying to read text from folder
prevChild = currChild;
PostMessage(currChild, WM_KEYUP, 0, 0);

                                 }
                                }
         while (currChild != 0);

0 个答案:

没有答案