[Last Call] Learn how to a build a cloud-first strategyRegister Now


Read a Rich text box in another application   API related.

Posted on 2006-04-28
Medium Priority
Last Modified: 2010-08-05
Anyone want to take a crack at how to use the API to read the entire contents (I dont care about lines, breaks or anything else) from a richtextbox in another application.  (outside of my control, a comercial application)

I have the hwnd for the control, and know I need to use the send message api (with em_gettextex or EM_GETTEXTRANGE)
but the problem is that they take a pointer and the pointer has to be in the same memory space as the control you are sending the message to.

Im sure there is a way to use VirtualAllocEx to make the call work accross processes, but for the life of me I cant figure it out.

Oh yeah, Im using VB.Net 2005 but can translate a C# answer.

Question by:HouseMusic
1 Comment
LVL 48

Accepted Solution

AlexFM earned 2000 total points
ID: 16567575
Is another application managed or not? If it is managed, there is simple solution which is called Managed Spy and can be found in MSDN Magazine, April 2006. If not, you need a lot of API which is difficult to translate to .NET and can be better implemented in C++/CLI.
Reading information from other unmaneged process requires injecting your code to this process. You can change ManageSpyLib from this article for your needs, it already contains required hooking framework. But when it finds unmanaged process, it stops hooking it, and this can be changed.
C++ ways are implemented here:

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question