是否可以将Windows Form应用程序作为VB.NET中的MDI子级注入到另一个应用程序中? [英] Is it possible to inject a Windows Form application into another application as an MDI Child in VB.NET?

查看:73
本文介绍了是否可以将Windows Form应用程序作为VB.NET中的MDI子级注入到另一个应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个与另一个程序交互的程序,并且我想将我的程序作为MDI子窗口注入到该程序中。这是否有可能,如果可以,可以在VB.NET中完成吗?

I am creating 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?

推荐答案

可以通过两种方式来完成,第一种方式是通过获取走弯路的副本,并使用pinvoke将您的流程注入该父级使用MDI控制器进行处理时,第二种方法虽然更危险,但仍要挂接到MDI控制器的窗口消息并注入将执行的代码-危险的部分是,由于MDI控制器在单独的进程中运行,因此您可能会产生尝试访问另一个进程的内存(即MDI控制器)时发生访问冲突。

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.

您肯定可以加入该过程并捕获消息,看看发现的示例此处(用C#编写,但您可以轻松地添加对VB.NET项目的引用)和此处

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.

这取决于您要走多远,您可能必须允许您的进程通过MDI控制器访问受保护的内存空间,而在其他进程中,该权限通过提升它...尝试在提供的链接中使用这些示例钩子,看看效果如何...

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...

这篇关于是否可以将Windows Form应用程序作为VB.NET中的MDI子级注入到另一个应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆