如何只根据注册表中的内容,查找注册的组件,然后东调用?dispatch怎么用啊?
msdn上的帮助,怎么都是错?

解决方案 »

  1.   

    通过察看注册表中组件的TypeLib键值确定该组件的类型库
    通过类型库进行调用至于怎么调用,你可以看看ITypeLib接口的说明
      

  2.   

    CWnd::CreateControl
    BOOL CWnd::CreateControl( LPCTSTR lpszClass, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL );BOOL CWnd::CreateControl( REFCLSID clsid, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL );看到有nID参数,没有试过
    只试过这个,以下代码为片段只是个思路,程序员大本营中有个例子,没找到.for(int jIndex=0;jIndex<m_pCheckBoxList.GetCount();jIndex++)
    {
    Position_CheckBox=m_pCheckBoxList.FindIndex(jIndex);
    pCheckBox=(CButton*)m_pCheckBoxList.GetAt(Position_CheckBox);
    m_CheckBoxSerial.Format("%d",jIndex);

    m_Rect.left=(10+jIndex%8*45);
    m_Rect.top=(20+jIndex/8*15);
    m_Rect.right=(55+jIndex%8*45);
    m_Rect.bottom=(35+jIndex/8*15);
    pCheckBox->Create(m_CheckBoxSerial,WS_VISIBLE|BS_CHECKBOX|BS_LEFTTEXT,m_Rect,this,200+jIndex);
    //pCheckBox->SetCheck(TRUE);
    }
    创建复选框N个.
    判断触发哪个ID
    OnSysCommand(UINT nID, LPARAM lParam)
    {
    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
    }
    else
    {
    CDialog::OnSysCommand(nID, lParam);
    }
    }
      

  3.   

    gjd111686(数字金刚):
      谢谢你的思路。