开发者

Replacing a window's control with another at runtime

开发者 https://www.devze.com 2022-12-22 10:54 出处:网络
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 windo

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开发者_Go百科 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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消