views:

44

answers:

1

I've got a handle to a window and its richEdit control. Would I be able to replace the said control with one of my own ? I'd like it to behave as the original one would, i.e., be a part of the window and suchlike.

I'll elaborate the scenario further - I'm currently disassembling an application one of whose features is a text editor. My current (restricted) environment has in it various hooks to procedures, one of which yield the handle to the editor window. Another allows me to procure the handle to the RichEdit20A controls the window hosts.

What I'd like to do is this - Overwrite the control with my own (its .NET equivalent presumably) and patch the app's GetWindowText calls to use the new one. To implement it, I plan to write the class library in C#/managed C++ and import it to my app (which is written in unmanaged C++).

Also, there can be an arbitrary number of instances of the text editor.

A: 

That sounds way too complex. Just replace its WndProc(GWL_WNDPROC), forwarding nothing, and then invalidate the HWND. That will force a redraw (WM_PAINT) which you can then capture. The owner probably wouldn't even notice (unless they had it hooked as well, of course)

MSalters