COM协同类的每个用户注册 [英] COM co-class per-user registration

查看:178
本文介绍了COM协同类的每个用户注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要通过向HKCU注册表配置单元(XP SP3,Windows 7,Windows 8)添加注册表项来实现COM合作伙伴的每个用户注册。通过调用VBScript CreateObject函数创建对象实例所需的注册表项的最小集合是什么?

Need to implement per-user registration of a COM co-class by adding registry entries to the HKCU registry hive (XP SP3, Windows 7, Windows 8). What is the minimal set of required registry entries to create an object instance by calling the VBScript CreateObject function?

UPD:VBScript实现

UPD: VBScript implementation

Sub RegisterComObject(Path, ProgId, ClsId)
    Dim Shell
    Set Shell = WScript.CreateObject("WScript.Shell")

    Shell.RegWrite "HKCU\Software\Classes\" & ProgId & "\", ""
    Shell.RegWrite "HKCU\Software\Classes\" & ProgId & "\CLSID\", ClsId

    Shell.RegWrite "HKCU\Software\Classes\CLSID\" & ClsId & "\", ""
    Shell.RegWrite "HKCU\Software\Classes\CLSID\" & ClsId & "\InprocServer32\", Path
    Shell.RegWrite "HKCU\Software\Classes\CLSID\" & ClsId & "\ProgID\", ProgID
End Sub

Sub UnregisterComObject(ProgId, ClsId)
    Dim Shell
    Set Shell = WScript.CreateObject("WScript.Shell")

    Shell.RegDelete "HKCU\Software\Classes\CLSID\" & ClsId & "\InprocServer32\"
    Shell.RegDelete "HKCU\Software\Classes\CLSID\" & ClsId & "\ProgId\"
    Shell.RegDelete "HKCU\Software\Classes\CLSID\" & ClsId & "\"

    Shell.RegDelete "HKCU\Software\Classes\" & ProgId & "\CLSID\"
    Shell.RegDelete "HKCU\Software\Classes\" & ProgId & "\"
End Sub


推荐答案

需要:


  1. HKEY_CURRENT_USER\Software\Classes\CLSID\ {your-CLSID-goes- here } (<_ c $ c>) 其常规语法

  2. HKEY_CURRENT_USER\Software\Classes \ {your-ProgID-going-here} 映射 ProgID CLSID ,以便 CreateObject 成功。

  1. HKEY_CURRENT_USER\Software\Classes\CLSID\{your-CLSID-goes-here} branch with subkey InprocServer32 (or, LocalServer32) with its regular syntax
  2. HKEY_CURRENT_USER\Software\Classes\{your-ProgID-goes-here} to map your ProgID to CLSID in order for CreateObject to succeed.

这篇关于COM协同类的每个用户注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆