如何检索activex控件的版本信息 [英] How to retrive the version information of an activex control

查看:185
本文介绍了如何检索activex控件的版本信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个麻烦:



我写了一个名为Comp.ocx的ActiveX,我在名为Test.exe的应用程序中使用它。

我希望ActiveX控件显示自己的版本信息。

然后我尝试在ActiveX中使用这些代码:

I've got in this trouble:

I wrote an ActiveX named "Comp.ocx",and I used it in an application named "Test.exe".
I want the ActiveX control display its own version infomation.
Then I tried to use these codes in the ActiveX:

HRSRC hsrc = FindResource(0,MAKEINTRESOURCE(VS_VERSION_INFO),RT_VERSION);
HGLOBAL hgbl=LoadResource(0,hsrc);
BYTE * pBt = (BYTE*)LockResource(hgbl);
VS_FIXEDFILEINFO* pFInfo = (VS_FIXEDFILEINFO*)(pBt+40);
CString str;
str.Format("ActiveX Version:%d.%d.%d.%d",HIWORD(pFInfo->dwFileVersionMS),
  LOWORD(pFInfo->dwFileVersionMS),HIWORD(pFInfo->dwFileVersionLS),
  LOWORD(pFInfo->dwFileVersionLS));
...





当我运行Test.exe时,我发现ActiveX控件失败了显示自己的版本

信息,但显示Test.exe的版本信息。



我试图搜索如何解决这个问题但没什么。



有人可以帮我吗?非常感谢!!!



我尝试过:



我试图在网上搜索如何解决这个问题,但发现没用。



When I ran "Test.exe",I found the ActiveX control failed to display its own version
information,but displayed the version infomation of "Test.exe".

I tried to search how to solve this,but nothing.

May someone help me? Thanks very much!!!

What I have tried:

I tried to search on the net how to solve this problem,but found useless.

推荐答案

在你的代码中你获取了exe.modul的资源。这是正确阅读文档。一个ocx在exe中作为副负载运行。



如果你想要ocx的版本信息,那么你最好实现一个接口来询问它。真是一个惊喜;-)



另一种解决方案是(manuelly)在注册表中搜索并找到注册信息的存储位置,并实现一些获取路径存储ocx的位置并获取文件信息。通常在HKS的CLSID中的某处。
In your code your are fetching the resources of the exe.modul. That is correct read the documentation. An ocx runs as side load in an exe.

If you want the version info of the ocx than you best implement an interface to ask for it. What a surpriseß ;-)

The other solution is to (manuelly) search in the registry and find where the registration information is stored and than implement some fetching of the path where the ocx is stored and get the file info. Normally somewhere in in HKR in CLSID.


这篇关于如何检索activex控件的版本信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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