Read a Rich text box in another application   API related.

Posted on 2006-04-28
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

    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:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now