我的分很多,想要的快来拿!

解决方案 »

  1.   

    你就在注册一遍不就知道了。
    运行:
    regsvr32 ****.ocx
      

  2.   

    active x 被注册后有一个id号留在注册表中,使用vc的一个函数可以查这个id号是否在注册表中,具体的查msdn,我记的有ProgId字串
      

  3.   

    你就在注册一遍不就知道了。
    运行:
    regsvr32 ****.ocx这样会出现一个已经注册的对话框!俺不想要!
      

  4.   

    菜单project->Add to Project->Components and Controls
    ->Registered ActiveX Controls
      

  5.   

    用CoCreaeInstance试一下
    如返回REGDB_E_CLASSNOTREG 说明控件没有注册。
    如返回S_OK 说明注册了
      

  6.   

    那就查注册表吧,regedit你不会是要在程序里运行吧
      

  7.   

    STDAPI CoCreateInstance(
      REFCLSID rclsid,     //Class identifier (CLSID) of the object
      LPUNKNOWN pUnkOuter, //Pointer to controlling IUnknown
      DWORD dwClsContext,  //Context for running executable code
      REFIID riid,         //Reference to the identifier of the interface
      LPVOID * ppv         //Address of output variable that receives 
                           // the interface pointer requested in riid
    );
    Parameters
    rclsid 
    [in] CLSID associated with the data and code that will be used to create the object. 
    pUnkOuter 
    [in] If NULL, indicates that the object is not being created as part of an aggregate. If non-NULL, pointer to the aggregate object's IUnknown interface (the controlling IUnknown). 
    dwClsContext 
    [in] Context in which the code that manages the newly created object will run. The values are taken from the enumeration CLSCTX. 
    riid 
    [in] Reference to the identifier of the interface to be used to communicate with the object. 
    ppv 
    [out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer. 
    Return Values
    S_OK 
    An instance of the specified object class was successfully created. 
    REGDB_E_CLASSNOTREG 
    A specified class is not registered in the registration database. Also can indicate that the type of server you requested in the CLSCTX enumeration is not registered or the values for the server types in the registry are corrupt. 
    CLASS_E_NOAGGREGATION 
    This class cannot be created as part of an aggregate. 
    E_NOINTERFACE 
    The specified class does not implement the requested interface, or the controlling IUnknown does not expose the requested interface. 
    不会用,rclsid找不着,能否做个例子?
    另外,我发现多次注册一个控件也无什么错误,但总归是心里不太舒服!
      

  8.   

    rclsid找不着!? 给Iunknown的GUID就可以
    ppv 返回一个IUnknown接口
    注册一个控件只是向注册表中写一些数据,当然多次注册没问题啦!
      

  9.   

    刚好写的程序,用的还行
    //Grid32.ocx是否注册判断
    //-----------------------------------
    HKEY hkey;
    LPCTSTR data_Set="SOFTWARE\\Classes\\CLSID\\{A8C3B720-0B5A-101B-B22E-00AA0037B2FC}\\InprocServer32\\";
    long ret=::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    data_Set,
    0,
    KEY_READ,
    &hkey);
    if(ret!=ERROR_SUCCESS)
    MessageBox("Grid32.ocx没有注册,将有部分功能无法正常运行","安装错误",MB_ICONERROR);
    else
    ::RegCloseKey(hkey);
      

  10.   

    IYourInterface* ppv;//IYourInterface是控件引出的其中一个接口HRESULT hre = CoCreateInstance(CLSID_MyOcx,
                                   NULL,
                                   CLX_LOCAL_SERVER,//记不清了,查MSDN
                                   IID_MyOcx,
                                   (void*)&ppv);
    其中MyOcx为你生成的Ocx的名字,可以在项目的MyOcx_Lib.cpp中找到如果hre == REGDB_E_CLASSNOTREG,则是没有注册