Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get filepath & filename of activeX component on target machine.

Status
Not open for further replies.

colttaylor

Programmer
Aug 20, 2002
117
0
0
US
I just spent nine days debugging a perfectly healthy program which suffered from... (you guessed it...) a mis-registered activex control. My version of the control was happily waiting for my program in my \SHARED directory and some other software's incompatable version of the control was hidden elsewhere on the machine. A batch file which called the other software was regsrv32'ing each activex control it used whenever that software was started up.

I have a standing policy of never being bit by the same bug twice. The only redemption from my nine profitless days is that I will make my program stronger so that it never can happen again.

I am planning to read a list into my program from its ini file. That list will contain the filename, (guid ?), creation date and size of each of the activex controls which my program needs. At program startup, my program will test each activex control in the list. The test will work as follows...

1). Ask Windows for the filepath and filename of the current regsrv32'ed activex control.
2). Detect if that filepath and filename points to a real existing file.
3). Compare the creation date and size of that file and to those described in the list.
4). Report any discrepencies in a dialog box with adequate details such that a technician can debug the problem. Then allow normal entry into the program. Instructions from that dialog box would explain to the tech that if the program runs properly, then the ini should be modified... and if it doesn't then the register components should be replaced with my standard ones.

Does anybody now how to do step 1 in VB 6 code?

Thanks in advance!
Peace,
Colt




If it's stupid but it works, it isn't stupid
 
If you need code to search the Windows registry, check this link:

Might be useful.

Actually, it's interesting for me too to know how this can be done.
The downloadable code in the link above surely include useless stuff, but you can probably get from it what you need.
I'll have a look into it too when I have time for that.

Eman_2005
Technical Communicator
 
Hi,

Has anyone found a better solution to this?

Searching through the registry seems to be a bit slow.

I want to find the Path name of a given registered OCX file

Thanks,

Rob D.

 
The registry is where you go to find out where it's registered. It's not as slow as you might think, as much of the registry is retained in memory.

You would:
1) Look under HKCR for the ProgID of the component. Use that to get the CLSID value
2) Look under HKCR\CLSID\<clsid value>
3) If it's an OCX or DLL, use the InProcServer32 value
4) If it's an EXE, use the LocalServer32 value

Not too hard.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top