使用ActiveX控件自动化VB6应用程序

时间:2022-03-29 21:06:12

I have a VB6 application that I don't have source code. This application uses third-party ActiveX controls. I want to automate these ActiveX controls. Is it possible to get the IUnknowns or Object references? For some of these, I can get the underlying HWNDs, but from what I can tell there isn't a generic way to convert these HWNDs to the ActiveX control.

我有一个VB6应用程序,我没有源代码。此应用程序使用第三方ActiveX控件。我想自动化这些ActiveX控件。是否有可能获得IUnknowns或Object引用?对于其中一些,我可以获得底层的HWND,但从我可以看出,没有通用的方法将这些HWND转换为ActiveX控件。

Some testing software allows you to script VB6 applications with ActiveX controls. How do they do it?

某些测试软件允许您使用ActiveX控件编写VB6应用程序脚本。他们是如何做到的呢?

3 个解决方案

#1


Are these ActiveX controls in a separate DLL? If so, you can use OLE View (an VS 6.0 tool) to open the dll and view all the interfaces, coclasse and etc.

这些ActiveX控件是否在单独的DLL中?如果是这样,您可以使用OLE视图(VS 6.0工具)打开DLL并查看所有接口,coclasse等。

#2


You might be able to using DLL injection via Microsoft Research Detours library. Basically you'd want to hook the cocreate for those specific controls. You will need to be ultra careful especially if you do anything cross-thread/cross-process (COM threading rules are vitally important).

您可以通过Microsoft Research Detours库使用DLL注入。基本上你想要为那些特定的控件挂钩cocreate。您需要非常小心,特别是如果您执行任何跨线程/跨进程(COM线程规则非常重要)。

On whole Detours is easy to use... but I've never tried it with COM routines. You might want to look at a different solution.

整个Detours很容易使用......但我从来没有尝试过COM例程。您可能希望查看其他解决方案。

Also note that Detours has some licensing restrictions on it that may affect your ability to distribute it.

另请注意,Detours对其有一些许可限制,可能会影响您分发它的能力。

Testing software may well just send the appropriate WM_XXX messages to the particular windows in question (eg. WM_MOUSEMOVE).

测试软件可能只是将相应的WM_XXX消息发送到有问题的特定窗口(例如WM_MOUSEMOVE)。

#3


Sorry to say but the VB6 EXE don't contain the manifests needed to pull out the COM objects it uses. You best bet is trying some of rbobby's suggestions especially about sending WM_XXX messages.

很抱歉,但VB6 EXE不包含拉出它使用的COM对象所需的清单。你最好的选择是尝试一些rbobby的建议,特别是关于发送WM_XXX消息。

#1


Are these ActiveX controls in a separate DLL? If so, you can use OLE View (an VS 6.0 tool) to open the dll and view all the interfaces, coclasse and etc.

这些ActiveX控件是否在单独的DLL中?如果是这样,您可以使用OLE视图(VS 6.0工具)打开DLL并查看所有接口,coclasse等。

#2


You might be able to using DLL injection via Microsoft Research Detours library. Basically you'd want to hook the cocreate for those specific controls. You will need to be ultra careful especially if you do anything cross-thread/cross-process (COM threading rules are vitally important).

您可以通过Microsoft Research Detours库使用DLL注入。基本上你想要为那些特定的控件挂钩cocreate。您需要非常小心,特别是如果您执行任何跨线程/跨进程(COM线程规则非常重要)。

On whole Detours is easy to use... but I've never tried it with COM routines. You might want to look at a different solution.

整个Detours很容易使用......但我从来没有尝试过COM例程。您可能希望查看其他解决方案。

Also note that Detours has some licensing restrictions on it that may affect your ability to distribute it.

另请注意,Detours对其有一些许可限制,可能会影响您分发它的能力。

Testing software may well just send the appropriate WM_XXX messages to the particular windows in question (eg. WM_MOUSEMOVE).

测试软件可能只是将相应的WM_XXX消息发送到有问题的特定窗口(例如WM_MOUSEMOVE)。

#3


Sorry to say but the VB6 EXE don't contain the manifests needed to pull out the COM objects it uses. You best bet is trying some of rbobby's suggestions especially about sending WM_XXX messages.

很抱歉,但VB6 EXE不包含拉出它使用的COM对象所需的清单。你最好的选择是尝试一些rbobby的建议,特别是关于发送WM_XXX消息。