你是想知道特定的OCX的CLSID吗?

解决方案 »

  1.   

    Visual studio 6.0的tools中有ActivX control test container和OLE viewer
    先用ActiveX control test container注册控件,再run OLE viewer,在
    Object Classes->Grouped by Component Category->Control里找到相应控件就
    能看到他的CLSID了!
      

  2.   

    打开Project菜单,选择Add To Project选项,在随后出现的子菜单中,选择Components And Controls,打开Developer Studio Components选择Tip of the Day,将其加入到Project中去。再编译连接运行,Tips of the Day出来了。不过此时Tips of the Day还没有任何内容。此时,需要打开project莱单,选择Add To Project选项,在打开的子菜单选择New,随后创建一个名为tips.txt的TXT文件,并加入到Project中去。用回车符来区分每一条Tip,注意,每条Tip不能以Tab跳格开头,且长度不能超过1000个字符。这样,加入Tip of the Day就大功告成了。
      在用AppWizard创建运用程序框架时,有一步询问程序是否需要ActiveX控件支持。因此,如果在创建运用程序框架时没有包含这一特性,后来的Project就不能加入ActiveX控件了。但这也不是绝对的,利用函数AfxEnableControlContainer()就可补上这一特性,在运用程序的InitInstance()_函数中加入该函数,并在预编译文件StdAfx.h中加入#include<Afxdisp.h>即可
      

  3.   

    先注册 regsvr32.exe XXXX.ocx
    后查注册表, look up XXXX 在那里能找到。
      

  4.   

    在注册表里找很快的哦,
    方法:
        运行 regedit.exe
        在查找中输入你想要找的ocx 文件名 如:actpmnt.ocx
        
        找到的clsid 为 {537BF624-27A6-11D0-8EFF-00A0C9054334}
        
        好好用的哦,赶快找吧! ^*^
      

  5.   

    问题是如果自己编程序来查CLSID的话,怎么查啊。这个问题是不是很难?呵呵
      

  6.   

    CLSID 和 ProgID 总要知道一个吧,要不怎么用呀,知道ProgID,可用API函数CLSIDFromProgID得到CLSID,知道CLSID,可用ProgIDFromCLSID得到ProgID。
    要不如果知道OCX的文件名,到注册表里枚举所有的OCX组件,然后一个个地比较,看文件名是不是你所想要的。总之,就好像你要找一个人,总要有一些关于他的特征吧。
      

  7.   

    CLSID 和 ProgID 总要知道一个吧,要不怎么用呀。
    如果知道ProgID,可用API函数CLSIDFromProgID得到CLSID;
    如果知道CLSID,可用ProgIDFromCLSID得到ProgID。
       要不如果知道OCX的文件名,到注册表里枚举所有的OCX组件,然后一个个地比较,看文件名是不是你所想要的。总之,就好像你要找一个人,总要有一些关于他的特征吧。
      

  8.   

    最简单而最有效的方法是使用Doump程序,你甚至还可以手工更改它。
      

  9.   

    假如该OCX含有类型库TYPELIB(一般都有)。
    告诉你一个标准的方法:
    用程序很简单的
    ITypeLib * pTypeLib;
    if(SUCCESS(LoadTypeLib(szFile,&pTypeLib))
    {}
      

  10.   

    假如该OCX含有类型库TYPELIB(一般都有)。
    告诉你一个标准的方法:USES_CONVERSION;
    ITypeLib * pTypeLib;
    if(SUCCESS(LoadTypeLib(T2OLE("FileName.ocx"),&pTypeLib))
    {
        TLIBATTR tlibAttr;
        pTypeLib->GetLibAttr(&tlibAttr);
        // tlibAttr.guid 就是你要的CLSID
        pTypeLib->Release();
    }  
      

  11.   

    给你一个例子:// TLBBrowserDlg.h : header file
    //
    #include "afxcoll.h"
    #include "afxtempl.h"
    class CTypeLibraryData
    {public:

    CString m_strCLSIDTypeLib;
    CString m_strDescription;
    long m_lMajorVersion;
    long m_lMinorVersion;
    };
    typedef CTypedPtrArray<CPtrArray, CTypeLibraryData*> TYPELIB_DATA;
    class CTLBBrowserDlg : public CDialog
    {
    // Construction
    public:
    CTLBBrowserDlg(CWnd* pParent = NULL); // standard constructor
    ~CTLBBrowserDlg();
    // Dialog Data
    //{{AFX_DATA(CTLBBrowserDlg)
    enum { IDD = IDD_TLBBROWSER_DIALOG };
    CListCtrl m_ListTypeAttribs;
    CListCtrl m_ListTypeInfo;
    CListCtrl m_ListCtrl;
    CString m_strGUIDTLB;
    CString m_strHelpString;
    CString m_strHelpFile;
    CString m_strErrorStatus;
    CString m_strTypeHelpFile;
    CString m_strTypeHelpString;
    CString m_strTypeDescription;
    //}}AFX_DATA // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CTLBBrowserDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    //}}AFX_VIRTUAL// Implementation
    protected:
    HICON m_hIcon; // Generated message map functions
    //{{AFX_MSG(CTLBBrowserDlg)
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnClickTypeList(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnClickTypeInfo(NMHDR* pNMHDR, LRESULT* pResult);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()private:
    BOOL EnumerateRegistryForTypeLibEntries();
    BOOL GetInformationForTLB(DWORD dwIndex);
    BOOL ExtractComponentsFromTLB(int iIndex);
    BOOL GetTypeInfoInformation(DWORD dwIndex);
    BOOL GetTypeAttributes();


    int m_nTLBListLastSelectedItem;
    TYPELIB_DATA m_arrayData;
    ITypeLib* m_pTypeLib;
    ITypeInfo* m_pCurrentTypeInfo;
    CImageList m_ImageList;};
    // TLBBrowserDlg.cpp : implementation file
    //#include "stdafx.h"
    #include "TypeLibHelper.h"
    #include "TLBBrowser.h"
    #include "TLBBrowserDlg.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog
    {
    public:
    CAboutDlg();// Dialog Data
    //{{AFX_DATA(CAboutDlg)
    enum { IDD = IDD_ABOUTBOX };
    //}}AFX_DATA // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CAboutDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL// Implementation
    protected:
    //{{AFX_MSG(CAboutDlg)
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
    {
    //{{AFX_DATA_INIT(CAboutDlg)
    //}}AFX_DATA_INIT
    }void CAboutDlg::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CAboutDlg)
    //}}AFX_DATA_MAP
    }BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
    //{{AFX_MSG_MAP(CAboutDlg)
    // No message handlers
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CTLBBrowserDlg dialogCTLBBrowserDlg::CTLBBrowserDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CTLBBrowserDlg::IDD, pParent)
    {
    //{{AFX_DATA_INIT(CTLBBrowserDlg)
    m_strGUIDTLB = _T("");
    m_strHelpString = _T("");
    m_strHelpFile = _T("");
    m_strErrorStatus = _T("");
    m_strTypeHelpFile = _T("");
    m_strTypeHelpString = _T("");
    m_strTypeDescription = _T("");
    //}}AFX_DATA_INIT
    // Note that LoadIcon does not require a subsequent DestroyIcon in Win32

    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //Initialize the interface pointers
    m_pTypeLib = NULL;
    m_pCurrentTypeInfo = NULL;

    m_ImageList.Create(IDB_IMAGE_LIST,16,4,RGB(128,128,128));
    }CTLBBrowserDlg::~CTLBBrowserDlg()
    {
    //Release our interfaces if(m_pTypeLib) m_pTypeLib->Release();
    if(m_pCurrentTypeInfo) m_pCurrentTypeInfo->Release();

    //Clean up the array
    for(int iIndex = 0 ; iIndex < this->m_arrayData.GetSize(); iIndex++)
    {
    delete m_arrayData.GetAt(iIndex);
    } m_arrayData.RemoveAll();
    }void CTLBBrowserDlg::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CTLBBrowserDlg)
    DDX_Control(pDX, IDC_LIST_TYPEINFODETAILS, m_ListTypeAttribs);
    DDX_Control(pDX, IDC_TYPE_INFO, m_ListTypeInfo);
    DDX_Control(pDX, IDC_TLB_LIST, m_ListCtrl);
    DDX_Text(pDX, IDC_TLB_GUID, m_strGUIDTLB);
    DDX_Text(pDX, IDC_TLB_HELPSTRING, m_strHelpString);
    DDX_Text(pDX, IDC_TLB_HELPFILE, m_strHelpFile);
    DDX_Text(pDX, IDC_STATUS, m_strErrorStatus);
    DDX_Text(pDX, IDC_TYPEINFO_HELPFILE, m_strTypeHelpFile);
    DDX_Text(pDX, IDC_TYPEINFO_HELPSTRING, m_strTypeHelpString);
    DDX_Text(pDX, IDC_TYPEINFO_TYPE, m_strTypeDescription);
    //}}AFX_DATA_MAP
    }BEGIN_MESSAGE_MAP(CTLBBrowserDlg, CDialog)
    //{{AFX_MSG_MAP(CTLBBrowserDlg)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    ON_NOTIFY(NM_CLICK, IDC_TLB_LIST, OnClickTypeList)
    ON_NOTIFY(NM_CLICK, IDC_TYPE_INFO, OnClickTypeInfo)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CTLBBrowserDlg message handlers
    BOOL CTLBBrowserDlg::OnInitDialog()
    {
    CDialog::OnInitDialog(); // Add "About..." menu item to system menu.
    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
    pSysMenu->AppendMenu(MF_SEPARATOR);
    pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
    } // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE); // Set big icon
    SetIcon(m_hIcon, FALSE); // Set small icon

    // TODO: Add extra initialization here //initialize the type library description control
    CRect rect;
    m_ListCtrl.GetWindowRect(&rect);
    m_ListCtrl.InsertColumn(1,"Type Library Description",LVCFMT_LEFT,rect.Width());
    ListView_SetExtendedListViewStyle(m_ListCtrl.GetSafeHwnd(),
    LVS_EX_FLATSB | LVS_EX_FULLROWSELECT);
    m_ListCtrl.SetImageList(&m_ImageList,LVSIL_SMALL); //initialize the type information control
    m_ListTypeInfo.GetWindowRect(&rect);
    m_ListTypeInfo.InsertColumn(1,"Type Information",LVCFMT_LEFT,rect.Width());
    ListView_SetExtendedListViewStyle(m_ListTypeInfo.GetSafeHwnd(),
    LVS_EX_FLATSB | LVS_EX_FULLROWSELECT);
    m_ListTypeInfo.SetImageList(&m_ImageList,LVSIL_SMALL); m_ListTypeAttribs.GetWindowRect(&rect);
    m_ListTypeAttribs.InsertColumn(1,"Type Attributes",LVCFMT_LEFT,rect.Width());
    ListView_SetExtendedListViewStyle(m_ListTypeAttribs.GetSafeHwnd(),
    LVS_EX_FLATSB | LVS_EX_FULLROWSELECT);
    m_ListTypeAttribs.SetImageList(&m_ImageList,LVSIL_SMALL); //Use the registry to get all registered typelibraries
    EnumerateRegistryForTypeLibEntries(); //Get the Typelibray Info for the registered typelibrary
    //Start with the first type library
    GetInformationForTLB(1); return TRUE;  // return TRUE  unless you set the focus to a control
    }void CTLBBrowserDlg::OnSysCommand(UINT nID, LPARAM lParam)
    {
    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
    }
    else
    {
    CDialog::OnSysCommand(nID, lParam);
    }
    }void CTLBBrowserDlg::OnPaint() 
    {
    if (IsIconic())
    {
    CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CDialog::OnPaint();
    }
    }// The system calls this to obtain the cursor to display while the user drags
    // the minimized window.
    HCURSOR CTLBBrowserDlg::OnQueryDragIcon()
    {
    return (HCURSOR) m_hIcon;
    }//////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: EnumerateRegistryForTypeLibEntries
    //
    // DESCRIPTION: 
    //
    // This function enumerates through the registry entries picking
    // up all registered type libraries
    ///////////////////////////////////////////////////////////////////////
    BOOL CTLBBrowserDlg::EnumerateRegistryForTypeLibEntries()
    {
    //Variables (declaration) HKEY   hKeyTypeLib = NULL;
    HKEY   hKeyClassTLB = NULL;
    DWORD  dwSubKeyIndex = 0;
    DWORD  dwCLSIDSubKeyIndex = 0;
    long  dwSizeOfDataBlock = 0;
    TCHAR  tchTypeCLSID[128];
    TCHAR  tchVersionInformation[128];
    DWORD  dwLibMajorVersion = 0;
    BOOL    bSuccess = TRUE;
    HRESULT hr = S_OK;
    TCHAR* pDescription = NULL;
    long lRegResult = 0;
    int iIndex = 0;
    BOOL bAlreadyInArray = FALSE; //Open the TypeLib Key under HKCR
    lRegResult = RegOpenKeyEx(HKEY_CLASSES_ROOT,"TypeLib",0,KEY_READ,&hKeyTypeLib) ; if(lRegResult != ERROR_SUCCESS)
    {
    TRACE("Error occured while trying to open key \r\n");
    bSuccess = FALSE;
    }

    //If all's well go ahead
    if(bSuccess)
    {
    ASSERT(hKeyTypeLib != NULL); //Enumerate thru all the typelib CLSID entries
    while(RegEnumKey(hKeyTypeLib,dwSubKeyIndex,
    tchTypeCLSID,sizeof(tchTypeCLSID)) == ERROR_SUCCESS)
    {
    //Open each CLSID Subkey  under the TypeLib key
    if(lRegResult=RegOpenKeyEx(hKeyTypeLib,tchTypeCLSID,0,KEY_READ, &hKeyClassTLB)!= ERROR_SUCCESS)
    {
    bSuccess = FALSE;
    } if(bSuccess)
    {
    dwCLSIDSubKeyIndex = 0;

    //Get each Subkey under the CLSID subkey
    // We should be able to get version information 
    while((lRegResult = RegEnumKey(hKeyClassTLB,dwCLSIDSubKeyIndex ,
    tchVersionInformation,sizeof(tchVersionInformation))) == ERROR_SUCCESS)
    {
    //Get the version information
    dwLibMajorVersion = atoi(tchVersionInformation); //Open the default key under version information
    HKEY hKeyVersion = NULL;
    lRegResult = RegOpenKeyEx(hKeyClassTLB,tchVersionInformation,0,KEY_READ,&hKeyVersion);    
    if(lRegResult != ERROR_SUCCESS)
    {
    bSuccess = FALSE;
    } if(bSuccess)
    {
    //Get the size of the string we are looking for.
    lRegResult = RegQueryValue(hKeyVersion,NULL,NULL,&dwSizeOfDataBlock);
    if(lRegResult != ERROR_SUCCESS)
    {
    bSuccess = FALSE;
    }
    } if(bSuccess)
    {
    //Got the string size
    //Allocate Memory and query for description
    pDescription = new TCHAR[dwSizeOfDataBlock + 1];
    lRegResult = RegQueryValue(hKeyVersion, 
    NULL,
    pDescription, 
    &dwSizeOfDataBlock) ;
    if(lRegResult != ERROR_SUCCESS)
    {
    delete [] pDescription;
    bSuccess = FALSE;
    }
    }

    if(bSuccess)
    {
    //append version information
    CString strDescription(pDescription);
    if(pDescription) 
    delete [] pDescription;
    strDescription += " ";
    strDescription += tchVersionInformation; if(strDescription != "")
    {
    //insert the information  in the list ctrl
    m_ListCtrl.InsertItem(iIndex,strDescription,2);

    //Fill up our user defined data structure

    CTypeLibraryData* pData = new CTypeLibraryData;

    pData->m_strDescription = strDescription;
    pData->m_strCLSIDTypeLib = CString(tchTypeCLSID);
    pData->m_lMajorVersion = atoi(tchVersionInformation);
    char* pMinor = strchr(tchVersionInformation,'.'); //Find a character in a string.

    pData->m_lMinorVersion = 0;
    if(pMinor)
    {
    pData->m_lMinorVersion = atoi(pMinor);
    }
    //Add it to the array
    m_arrayData.Add(pData); iIndex++;
    }//add it to the array
    }//if bSuccess
    dwCLSIDSubKeyIndex++;
    }//Inner Enumeration
    RegCloseKey(hKeyClassTLB);
    }//if the CLSID Subkey portion is successfully opened
    dwSubKeyIndex++;
    }//Outer Enumeration
    RegCloseKey(hKeyTypeLib) ;
    }//if the TypeLib under HKCR  key is opened
    return TRUE;
    }//////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: GetInformationForTLB(DWORD dwIndex)
    //
    // DESCRIPTION: 
    // Pick up type information for each registered type library
    // 
    // 
    ///////////////////////////////////////////////////////////////////////
    BOOL CTLBBrowserDlg::GetInformationForTLB(DWORD dwIndex)
    {
    BOOL bSuccess = TRUE;
    HRESULT hr = S_OK;
    BSTR bstrHelpString = NULL;
    BSTR bstrCLSID = NULL;
    BSTR bstrHelpFileName = NULL;
    CLSID clsidTypeLib; //Set default display strings
    CString strHelpString("No Help string available");
    CString strHelpFileName("No Help File available");

    //--------------------得到TypeLib的CLSID---------------------------------
    //--
    //Get  information from the array
    CTypeLibraryData* pData = m_arrayData.GetAt(dwIndex);
    if(!pData)
    {
    bSuccess = FALSE;
    } //Set the current type library CLSID
    this->m_strGUIDTLB = pData->m_strCLSIDTypeLib; //Get the CLSID from the stored string
    if(bSuccess)
    {
    BSTR bstrCLSID = pData->m_strCLSIDTypeLib.AllocSysString();
    hr = CLSIDFromString(bstrCLSID,&clsidTypeLib);
    if(hr != S_OK)
    {
    bSuccess = FALSE;
    }
    if(bstrCLSID) 
    ::SysFreeString(bstrCLSID);
    }
    //--
    //--------------------得到TypeLib的CLSID--------------------------------- /*
    ** Release the typelibrary
    */
    if(m_pTypeLib)
    m_pTypeLib->Release(); //Load the typelibrary 
    if(bSuccess)
    {
    /*HRESULT LoadRegTypeLib( 
       REFGUID  rguid,             
       unsigned short  wVerMajor,  
       unsigned short  wVerMinor,  
       LCID  lcid,                 
       ITypeLib FAR* FAR*  pptlib);
       */
      hr = LoadRegTypeLib (clsidTypeLib,
     (unsigned short)pData->m_lMajorVersion,
     (unsigned short)pData->m_lMinorVersion,
     0,
     &m_pTypeLib) ;
    if(hr != S_OK)
    {
    CString strError;
    strError.Format("LoadRegTypeLib returned a HRESULT of %x",hr);
    m_strErrorStatus = strError;
    bSuccess = FALSE;
    }
    } if(hr != S_OK)
    {
    bSuccess = FALSE;
    }

    //Get the help string and the help file name
    if(bSuccess)
    {
    ASSERT(m_pTypeLib); m_pTypeLib->GetDocumentation((unsigned int)-1,NULL,&bstrHelpString,NULL,&bstrHelpFileName);
    if(bstrHelpString)
    {
    if(CString(bstrHelpString) != "") 
    strHelpString = CString(bstrHelpString);
    ::SysFreeString(bstrHelpString);
    }
    if(bstrHelpFileName == NULL)
    {
    if(CString(bstrHelpFileName) != "") 
    strHelpFileName = CString(bstrHelpFileName);
    ::SysFreeString(bstrHelpFileName);
    }
    } //Extract the Type Information from the Typelibrary
    if(m_pTypeLib && bSuccess)
    {
    ExtractComponentsFromTLB(dwIndex);
    }

    this->m_strHelpString = strHelpString;
    this->m_strHelpFile = strHelpFileName;
    UpdateData(FALSE); return TRUE;
    }
    //////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: ExtractComponentsFromTLB(int iIndex)
    //
    // DESCRIPTION: 
    // 
    // Actual function that culls out the type information from ITypeLib interface
    // 
    ///////////////////////////////////////////////////////////////////////
    BOOL  CTLBBrowserDlg::ExtractComponentsFromTLB(int iIndex)
    {
    long lTypeInfoCount = 0;
    BSTR bstrName = NULL;
    BOOL bSuccess = TRUE; ASSERT(m_pTypeLib != NULL);

    //Get the type information count
    lTypeInfoCount = m_pTypeLib->GetTypeInfoCount(); //Make sure that we have type information
    if(lTypeInfoCount == 0)
    {
    bSuccess = FALSE;
    }

    if(bSuccess)
    {
    //Get the help string and help file for each TypeInfo
    for(long i = 0; i  < lTypeInfoCount ; i++)
    {
      m_pTypeLib->GetDocumentation(i, &bstrName, NULL, NULL, NULL);
      this->m_ListTypeInfo.InsertItem(i,CString(bstrName),3);
      if(bstrName)
       ::SysFreeString(bstrName);
    }               
    }
    return TRUE;
    }///////////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: GetTypeInfoInformation(DWORD dwIndex)
    //
    // DESCRIPTION: 
    // 
    // Get details for each TypeInfo (whether CoClass , dispinterface, Enum ... etc.)
    // 
    ///////////////////////////////////////////////////////////////////////
    BOOL CTLBBrowserDlg::GetTypeInfoInformation(DWORD dwIndex)
    {
    //Variables (initialize) TYPEKIND typeKind;
    BSTR bstrHelpFileName = NULL;
    BSTR bstrHelpString = NULL;
    BOOL bSuccess = TRUE;
    HRESULT hr = S_OK;
    CString strHelpFileName("No help file available");
    CString strHelpString("No Help string available");

    //Get the information about the TypeInfo
    hr = m_pTypeLib->GetTypeInfoType((unsigned int)dwIndex, &typeKind); //index into our global array to pick up the description
    if(hr != S_OK)
    {
    bSuccess = FALSE;
    m_strTypeDescription = "";
    }
    else
    {
    m_strTypeDescription = g_arrClassification[typeKind];
    }

    //get the help string and help file name
    if(bSuccess)
    {
    hr = m_pTypeLib->GetDocumentation(
    (unsigned int)dwIndex, 
    NULL,
    &bstrHelpString, 
    NULL,
    &bstrHelpFileName); if(hr != S_OK)
    {
    bSuccess = FALSE;
    }
    else
    {
    if(bstrHelpString)
    {
    if(CString(bstrHelpString) != "") 
    strHelpString = CString(bstrHelpString);
    }
    if(bstrHelpFileName)
    {
    if(CString(bstrHelpFileName) != "") 
    strHelpFileName = CString(bstrHelpFileName);
    }
    }
    }//if bSuccess
    //Get the Type information ptr (ITypeInfo ptr)
    //From which we can get the ITypeAttr ptr
    if(bSuccess)
    {
    ASSERT(m_pTypeLib);
    if(m_pCurrentTypeInfo) m_pCurrentTypeInfo->Release();

    hr = m_pTypeLib->GetTypeInfo((unsigned int)dwIndex, &m_pCurrentTypeInfo);

    if(hr != S_OK)
    {
    bSuccess = FALSE;
    }
    } if(bSuccess)
    {
    ASSERT(m_pCurrentTypeInfo);

    //All's well (we got the ITypeInfo ptr)
    //Now go ahead and get the ITypeAttr ptr
    GetTypeAttributes();
    } this->m_strTypeHelpFile = strHelpFileName;
    this->m_strTypeHelpString = strHelpString;
    UpdateData(FALSE); return bSuccess;
    }///////////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: OnClickTypeList(NMHDR* pNMHDR, LRESULT* pResult) 
    //
    // DESCRIPTION: 
    // 
    // Changes that need to occur when the user clicks the Type Library list ctrl
    // 
    ///////////////////////////////////////////////////////////////////////
    void CTLBBrowserDlg::OnClickTypeList(NMHDR* pNMHDR, LRESULT* pResult) 
    {
    // TODO: Add your control notification handler code here
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    // TODO: Add your control notification handler code here

    if(pNMListView->iItem != -1)
    {
    m_nTLBListLastSelectedItem = pNMListView->iItem;
    this->m_ListTypeInfo.DeleteAllItems();
    this->m_ListTypeAttribs.DeleteAllItems();
    m_strErrorStatus = "Status: S_OK";
    GetInformationForTLB(pNMListView->iItem);
    UpdateData(FALSE);
    }
    *pResult = 0;
    }
    ///////////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: OnClickTypeInfo(NMHDR* pNMHDR, LRESULT* pResult) 
    //
    // DESCRIPTION: 
    // 
    // Changes that need to occur when the user clicks the Type Information list ctrl
    // 
    ///////////////////////////////////////////////////////////////////////void CTLBBrowserDlg::OnClickTypeInfo(NMHDR* pNMHDR, LRESULT* pResult) 
    {
    // TODO: Add your control notification handler code here
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    // TODO: Add your control notification handler code here

    if(pNMListView->iItem != -1)
    {
    if(m_nTLBListLastSelectedItem != -1)
    {
    this->m_ListTypeAttribs.DeleteAllItems();
    GetTypeInfoInformation(pNMListView->iItem);
    }
    }
    *pResult = 0;
    }///////////////////////////////////////////////////////////////////////////
    //
    // FUNCTION: GetTypeAttributes
    //
    // DESCRIPTION: 
    // 
    // Get the Type Attributes from the type information
    // 
    ///////////////////////////////////////////////////////////////////////
    BOOL CTLBBrowserDlg::GetTypeAttributes()
    {
    ASSERT(m_pCurrentTypeInfo); MEMBERID memberID;
    FUNCDESC* pFuncDesc = NULL;
    VARDESC* pVarDesc = NULL;
    TYPEATTR* pTypeAttributes = NULL;
    BSTR bstrMethod = NULL;
    BSTR bstrProperty = NULL;

    //Get the TypeAttributes
    m_pCurrentTypeInfo->GetTypeAttr(&pTypeAttributes); int iIndex = 0;
    //得到所有的方法
    for(int iIter = 0; iIter < pTypeAttributes->cFuncs; iIter++)
    {
      //Get the function description
      m_pCurrentTypeInfo->GetFuncDesc(iIter, &pFuncDesc) ;
      
      //Get the member ID
      memberID = pFuncDesc->memid;
      
      //Get the name of the method
      m_pCurrentTypeInfo->GetDocumentation(memberID, &bstrMethod, NULL, NULL, NULL);

      this->m_ListTypeAttribs.InsertItem(iIndex,CString(bstrMethod),1);
      
      if(bstrMethod) ::SysFreeString(bstrMethod); //Release our function description stuff
      m_pCurrentTypeInfo->ReleaseFuncDesc(pFuncDesc);   iIndex++;
      } //得到所有的属性
    for(iIter = 0; iIter < pTypeAttributes->cVars; iIter++)
    {
      //Get the property description
      m_pCurrentTypeInfo->GetVarDesc(iIter, &pVarDesc) ;
      
      //Get the member ID
      memberID = pVarDesc->memid;
      
      //Get the name of the property
      m_pCurrentTypeInfo->GetDocumentation(memberID, &bstrProperty, NULL, NULL, NULL);

      this->m_ListTypeAttribs.InsertItem(iIndex,CString(bstrProperty),0);
      
      if(bstrProperty) ::SysFreeString(bstrProperty); //Release our variable description stuff
      m_pCurrentTypeInfo->ReleaseVarDesc(pVarDesc);

      iIndex++;
    }
    return TRUE;
    }
      

  12.   

    方法一(用Frontpage):
    1.首先确保该ocx已经注册到你的计算机.
    2.用Frontpage新建一个newpage.
    3.在Normal标签页中,插入--->Advanced-->ActiveX Control.
    4.选择你的 ocx,OK.
    5.在Normal标签页中点击你的 ocx.
    6.选择HTMLl标签页.
    7.反白的就是该ocx的id.