To get CLSID of OCX from its file name.
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
Re: To get CLSID of OCX from its file name.
Does CLSIDFromProgID() (where the OCX filename is the 'ProgID') do the job? (I don't know, I'm just trying to suggest a possibility).
Re: To get CLSID of OCX from its file name.
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.