public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
 
// enum.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <cstdio>
#include <cstring>
#include <windows.h>
#include <comcat.h>
 
int _tmain(int argc, _TCHAR* argv[])
{
//Initialise COM libraries
CoInitialize (NULL);
 
//The Component Category Manager implemented by System implements
//this interface
ICatInformation *pCatInfo=NULL;
 
//Create an instance of standard Component Category Manager
HRESULT hr=CoCreateInstance (CLSID_StdComponentCategoriesMgr ,
NULL,
CLSCTX_INPROC_SERVER,
IID_ICatInformation ,
(void **)&pCatInfo);
 
//Increase ref count on interface
pCatInfo->AddRef ();
 
//IEnumGUID interface provides enumerator for enumerating through
//the collection of COM objects
IEnumGUID *pEnumGUID=NULL;
 
//We are intersted in finding out only controls so put CATID_Control
//in the array
CATID pcatidImpl[1];
CATID pcatidReqd[1];
pcatidImpl[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_OK
CLSID 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);
printf("%S\n", bstrClassName);
//Add string in our listbox
}
 
//we are done so now release the interface ptr
pCatInfo->Release ();
 
CoUninitialize ();
}

That is really useful. Now if I can figure out how to do that from powershell.

I'm not sure if this actually lists them all, but you should be able to run it as an exe

It lists the one I need when I run it as an EXE. My end goal is to uninstall the activex control via Powershell.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.