C# 从另一个独立应用程序获取数据?
如何让我的 C# 程序从另一个应用程序获取数据?
假设应用程序是“Yahoo Messenger”,有人在聊天框中对你说“嗨”...
现在,我希望我的 C# 程序从“Yahoo Messenger 聊天框”中读取/获取该数据或信息将其打印在我的申请表上吗?是否可以?
How will I let my c# program to get data from another application?
assume that application is, for example , "Yahoo Messenger" and someone say to you "hi there" on the chatbox...
Now, I want my c# program to read / get that data or information from "Yahoo Messenger chat box" in print it on my application? is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将需要使用 Visual Studio 工具名称 SPY++ 来了解 win32 api 的流程。
之后,请参阅这些链接
从其他应用程序获取文本。
http:// /www.dreamincode.net/forums/topic/66140-scraping-the-text-from-another-application-with-win32-api/
实现部分内容后代码,请重新发布与编程相关的更具体的问题
You will need to use visual studio tool name SPY++ for understanding the flow of win32 api.
After that refer to these link
Get text from another application.
http://www.dreamincode.net/forums/topic/66140-scraping-the-text-from-another-application-with-win32-api/
After implementing some part of the code , please repost more specific question related to programming
如果该应用程序(例如 Yahoo Messenger)为其他应用程序提供一个接口(例如:COM)来访问其信息,那就很容易了。
如果没有,您将必须通过 Windows API,捕获文本所在的确切窗口的句柄等。
您知道您的其他应用程序是什么吗?
编辑:
检查这个雅虎答案。有人问了同样的问题,也许答案中提供的链接会对您有所帮助: http: //answers.yahoo.com/question/index?qid=20081126161509AAhr6Dz
雅虎问答帖子 内容:
It will be easy if that application (Yahoo messenger for example) provides an interface (ex: COM) for other applications to access its information.
If not, you will have to go through Windows API, capturing the handle of the exact window where the text is and all.
Have you any idea what your other application is?
EDIT:
Check this Yahoo Answer. Someone has asked the same question, maybe the links provided in the answer would help you: http://answers.yahoo.com/question/index?qid=20081126161509AAhr6Dz
Yahoo Answers post content:
如果您可以控制“该应用程序”(例如YahooMessenger),您可以使用winapi创建共享内存:
一旦您拥有该缓冲区,您可以使用CopyMemory或任何api向其中写入数据。
在您的 C# 应用程序中,您可以使用 InterOp (P-invoke) 来调用 WinAPI:
使用:
OpenFileMapping(),MapViewOfFile()
等打开共享内存
使用:
Marshal.ReadInt32()、Marshal.StructureToPtr()
等将数据读取到 C# 数据结构。
If you have control over "that application" (e.g.Yahoo messenger), you can create a shared memory using winapi:
Once you have that buffer, you can write data to it using CopyMemory or whatever api.
In your C# application you can use InterOp (P-invoke) to call WinAPI:
Use:
OpenFileMapping(),MapViewOfFile()
etc. to open the shared memory
Use:
Marshal.ReadInt32(), Marshal.StructureToPtr()
etc to read the data to your C# data structures.