开发者

Is it possible to inject a Windows Form application into another application as an MDI Child in VB.NET?

I am creat开发者_如何学运维ing a program that interacts with another program and I would like to "inject" my program into this program as an MDI Child window. Is this even possible, and if so can it be done in VB.NET? What kind of pitfalls are associated with doing this?


It could be done, in two ways, the first way, by obtaining a copy of Detours, and use pinvoke to inject your process into that parent process with MDI controller, the second way, although more dangerous, is to hook into the MDI controller's window messages and inject code that will execute - the dangerous part is that, since MDI controller is running in a separate process, you may incur a "Access violation" when trying to access another process's memory, namely the MDI controller.

You can most certainly hook into that process and trap the messages, have a look at this sample found here (written in C#, but you can easily add a reference to your VB.NET project) and here also.

It depends on how far you want to go, you may have to allow your process to access the protected memory space by your MDI controller which is in the other process by elevating it... try those example hooks in the links provided and see how it goes...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜