注册COM对象不一定要注册LIBID_Xxx吧?

解决方案 »

  1.   

    我当然知道最好注册了,最好还写什么IDL之类的
    我只是想知道注册究竟有什么用?怎么用?
    请luohualiushui(落花流水) 说的详细点好吗?
      

  2.   

    Res
    The ITypeLibInfo object controls information about the properties contained in the specified type library such as its name, GUID, interfaces, location, and version. For example, using these properties, you could add the methods of a specified interface to a project. See the Visual Studio Implement Interface Wizard for an example.Note   See Interpreting Visual C++ Wizard Model Examples for more information about how properties are called in both the HTML and the default.js files of a custom wizard.
    Requirements
    Namespace: VCWIZLibFile: vcwiz.dllExample
    // From Visual Studio's Implement Interface Wizardfunction AddTypeLibOption(oTypeLibsSelect, oTypeLib, strVersion)
    {
        var oOption = document.createElement("OPTION");
       oOption.text = oTypeLib.Name + "<" + (strVersion.length ? strVersion : "1.0") + ">";
       oOption.value = oTypeLib.Location;
       oTypeLibsSelect.add(oOption);
    }See Also
      

  3.   

    那是类型库的ID值,如果楼主的COM组件希望能够提供类型信息,应该注册类型库,这样可以方便一些智能环境(如VC)生成对应接口的包装类以方便编写程序。并且如果是支持自动化技术的COM组件,则一定要提供类型信息(否则等于不支持自动化)。支持自动化就是支持IDispatch,客户端可以通过IDispatch中的几个函数动态获得这个组件所提供的接口的类型信息(这些类型信息就是通过这个组件注册的LIBID,在HKCR\TypeLib键下找到对应的类型库文件路径获得的),以此实现迟绑定效果,这样的客户端一般是脚本语言翻译器,如vbScript、javaScript等。