我想获得应用程序的控件/句柄的内容..
这是实验代码..
Process[] processes = Process.GetProcessesByName("Notepad");
foreach (Process p in processes)
{
StringBuilder sb = new StringBuilder();
IntPtr pFoundWindow = p.MainWindowHandle;
List <IntPtr> s = GetChildWindows(pFoundWindow);
// function that returns a
//list of handle from child component on a given application.
foreach (IntPtr test in s)
{
// Now I want something here that will return/show
the text on the notepad..
}
GetWindowText(pFoundWindow, sb,256);
MessageBox.Show(sb.ToString()); // this shows the title.. no problem with that
}
Run Code Online (Sandbox Code Playgroud)
任何的想法?我已经阅读了一些API方法,如GetWindowText或WM_GETTEXT,但我不知道如何使用它或将其应用于我的代码..我需要一个教程或示例代码...
提前致谢 : )
我如何让我的c#程序从另一个应用程序获取数据?
假设应用程序是,例如,"雅虎信使",有人在聊天框上对你说"你好"...
现在,我希望我的c#程序从我的应用程序中打印出来的"Yahoo Messenger聊天框"中读取/获取该数据或信息?可能吗?
如何获取网站的内容?
我正在谈论的网站只是一个简单的页面,上面没有任何其他链接:
以此为例:http://introcs.cs.princeton.edu/java/23recursion/Queens.java.html
我只想阅读内容并将其保存在字符串中,以便稍后我可以轻松操作它.
任何的想法?还是教程?
提前致谢 : )