Click to See Complete Forum and Search --> : To get CLSID of OCX from its file name.


Onkar Singh
May 27th, 1999, 01:26 AM
Hi,
I have an oCX ( say abc.ocx ). How can I get cLSID for it ( Programmatically )
I am using VC++. I have used GetClassFile which takes file name as [IN] parameter and gives clsid as [OUT] parameter, but it is failing.
I do not want to use manaual effort of exploring registry using regedit.

Thanks,
Onkar

Jason Teagle
May 27th, 1999, 02:53 AM
Does CLSIDFromProgID() (where the OCX filename is the 'ProgID') do the job? (I don't know, I'm just trying to suggest a possibility).

RajM
May 27th, 1999, 11:38 AM
Onkar,
do to want tofind the CLSID of the control contained in a OCX?A OCX can possibly contain many controls.So there is a possiblity that there might be many CLSID's ina single OCX.
The function GetClassFile is meant for finding CLSID of OLE objects stored in a structured storage file.A OCX is not a structured storage file.
So what you need to do is use the ITypeLib and ITypeInfo interfaces and LoadTypeLib.