Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C++
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));
...


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.
Posted
Updated 7-Mar-18 6:08am

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900