【问题标题】:How to list all ActiveX controls?如何列出所有 ActiveX 控件?
【发布时间】:2010-12-11 13:46:20
【问题描述】:

有没有办法列出/浏览系统中或特定应用程序中的所有 ActiveX 控件?这可以从某些管理屏幕以及代码中完成吗?

感谢任何帮助。

【问题讨论】:

    标签: com interface activex


    【解决方案1】:

    我通常使用OLEview 来检查我电脑上的 COM/ActiveX 对象,因为它还允许我通过对象公开inspect the interfaces

    Jeff Attwood on stackoverflow 已发布了一种程序化方法。

    【讨论】:

      【解决方案2】:

      试试这个ActiveXHelper

      【讨论】:

        【解决方案3】:
        //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];
        // Want only my Plugin Category
        pcatidImpl[0]=CATID_MyPlugin;
        pcatidReqd[1]=CATID_MyPlugin;
        
        // Want all Active X Control
        //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);
        CString strControlName(bstrClassName);
        //Add string in our listbox
        m_list1.AddString (strControlName);
        }
        
        //we are done so now release the interface ptr
        pCatInfo->Release ();
        
        CoUninitialize ();
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2011-01-10
          • 1970-01-01
          • 2013-09-29
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-03-03
          相关资源
          最近更新 更多