绕道拦截VB6按钮点击事件
我想将自己的 DLL 注入到 VB6 进程中,以覆盖按钮的默认单击行为。目标是调用我的方法,并且永远不要在单击事件处理程序中调用原始 VB6 代码。
Microsoft Detours API 似乎可以提供帮助。这些示例向我展示了如何将 DLL 注入正在运行的进程中;但我不确定我应该绕道的功能。
理想情况下,我会喜欢 Detours API 的 .Net 包装器。
任何帮助将不胜感激。
I want to inject my own DLL into a VB6 process, to override the default click behavior of a button. The goal, to call my method, and never call the orig VB6 code in the click event handler.
It appears the Microsoft Detours API can help. The samples show me how-to inject my DLL, into the running process; but I'm not sure the function I should be detouring.
Idealy, I would love a .Net wrapper for the Detours API.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无需使用 Detours 来完成此任务,请查看:为您完成的子类外部程序
这个 C++/ActiveX 解决方案将允许您在 VB6 中对当前进程之外的窗口进行子类化。我对 .NET 不太熟悉,但我确实知道商业解决方案 Desaware SpyWorks for .NET 也提供此功能。首先做好你的功课,可能有一个免费的解决方案,如果有的话请回帖告诉我们。 :)
No need to use Detours for this task, check out: Subclass External Programs done for you
This C++/ActiveX solution will allow you to subclass windows outside your current process in VB6. I am less familiar with .NET, but I do know that the commercial solution Desaware SpyWorks for .NET also provides this functionality. Do your homework first, there's probably a free solution out there, and if so post back and let us know. :)
如果它是一种同时影响所有按钮的方法,那么我认为这将是您要做的原创研究;我认为没有人曾经觉得有必要在这种程度上规避 VB 运行时。否则,如果它只是一个特定的按钮或表单,子类化是经过验证的正确方法。
有关 VB6 的高级信息,请查看 Karl Peterson 的经典 VB 站点:
http://vb.mvps.org/samples/< /a>
该网站上托管的是 Bruce McKinney 的优秀著作“Hardcore Visual Basic”:
http://vb.mvps .org/hcvb.asp
If its a way to affect all buttons at once, then I think this is going to be original reseach for you to do; I don't think anybody else has ever felt the need to circumvent the VB runtime to this degree. Otherwise, if it's just a particular button or form, subclassing is the tried-and-true way to go.
For advanced VB6 info, check out Karl Peterson's Classic VB site:
http://vb.mvps.org/samples/
Hosted on that site is Bruce McKinney's excellent book "Hardcore Visual Basic":
http://vb.mvps.org/hcvb.asp