initialise com librariescoinitialize (NULL); //the component category manager implemented by system implements //this interfaceicatinformation * pcatinfo=null; //create an instance of standard component category managerhresult hr=cocreateinstance (clsid_stdcomponentcategoriesmgr , NULL, CLSCTX_INPROC_SERVER, iid_ icatinformation , (void **) &pcatinfo); //increase ref count on interfacepcatinfo->addref (); //ienumguid interface provides enumerator for enumerating through //the collection of com objectsienumguid *penumguid=null; //we are intersted in finding out only controls so put catid_control //in the arraycatid pcatidimpl[1]; CATID PCATIDREQD[1];p catidimpl[0]=catid_control; //now enumerate the classes i.e. com objects of this type.pcatinfo->enumclassesofcategories (1, pcatidimpl, 0, pcatidReqd ,            &PENUMGUID); //Enumerate as long as you get s_okclsid clsid; while ( (Hr= penumguid->next ( 1, &clsid, NULL ) ==s_ok ) { bstr bstrclassname; //get the information of class //this is what msdn says about the parameters /*----------------------------------------------- USERCLASSTYPE_FULL the full type name of the class. userclasstype_short A short name (maximum of 15 characters) that is used for popup menus and the links dialog box. userclasstype_appname the name of the application servicing the class and is used in the Result text in dialog boxes. --------------------------- --------------------*/ olereggetusertype (clsid,userclasstype_full,&bstrclassname); cstring strcontrolname (bstrclassname); //add string in our listbox m_list1. addstring (strcontrolname);} //we are done so now release the interface ptrpCatInfo->Release (); couninitialize ();
List all registered ActiveX controls