当前位置: 首页>>代码示例>>Python>>正文


Python _winreg.DeleteKey方法代码示例

本文整理汇总了Python中_winreg.DeleteKey方法的典型用法代码示例。如果您正苦于以下问题:Python _winreg.DeleteKey方法的具体用法?Python _winreg.DeleteKey怎么用?Python _winreg.DeleteKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_winreg的用法示例。


在下文中一共展示了_winreg.DeleteKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: unregister

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def unregister(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.DeleteValue( hKey, "ButtonText" )
        _winreg.DeleteValue( hKey, "ClsidExtension" ) # for calling COM object
        _winreg.DeleteValue( hKey, "CLSID" )
        _winreg.DeleteValue( hKey, "Default Visible" )
        _winreg.DeleteValue( hKey, "ToolTip" )
        _winreg.DeleteValue( hKey, "Icon" )
        _winreg.DeleteValue( hKey, "HotIcon" )
        _winreg.DeleteKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
    except WindowsError:
        print "Couldn't delete Standard toolbar regkey."
    else:
        print "Deleted Standard toolbar regkey."

#
# test implementation
# 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:iebutton.py

示例2: del_subkey

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def del_subkey(self,name):
        """Delete the named subkey, and any values or keys it contains."""
        self.sam |= KEY_WRITE
        subkey = self.get_subkey(name)
        subkey.clear()
        _winreg.DeleteKey(subkey.parent.hkey,subkey.name) 
开发者ID:NVDARemote,项目名称:NVDARemote,代码行数:8,代码来源:regobj.py

示例3: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    try:
        key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,
                                "directory\\shellex\\CopyHookHandlers\\" +
                            ShellExtension._reg_desc_)
    except WindowsError, details:
        import errno
        if details.errno != errno.ENOENT:
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:copy_hook.py

示例4: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    try:
        key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,
                            "Folder\\ShellEx\\ColumnHandlers\\" + \
                            str(ColumnProvider._reg_clsid_) )
    except WindowsError, details:
        import errno
        if details.errno != errno.ENOENT:
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:column_provider.py

示例5: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    kn = r"Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\%s" \
         % (EmptyVolumeCache._reg_desc_,)
    try:
        key = _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE, kn)
    except WindowsError, details:
        import errno
        if details.errno != errno.ENOENT:
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:empty_volume_cache.py

示例6: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    try:
        key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,
                                "Python.File\\shellex\\ContextMenuHandlers\\PythonSample")
    except WindowsError, details:
        import errno
        if details.errno != errno.ENOENT:
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:context_menu.py

示例7: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    paths = [
        "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\" + ShellFolder._reg_clsid_,
        "%s\\shellex\\ContextMenuHandlers\\%s" % (ContextMenu._context_menu_type_, ContextMenu._reg_desc_),
    ]
    for path in paths:
        try:
            _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE, path)
        except WindowsError, details:
            import errno
            if details.errno != errno.ENOENT:
                print "FAILED to remove %s: %s" % (path, details) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:folder_view.py

示例8: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def DllUnregisterServer():
    import _winreg
    try:
        key = _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE,
                            "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" \
                            "Explorer\\Desktop\\Namespace\\" + \
                            ShellFolderRoot._reg_clsid_)
    except WindowsError, details:
        import errno
        if details.errno != errno.ENOENT:
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:shell_view.py

示例9: UnregisterAddin

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def UnregisterAddin(klass):
    import _winreg
    try:
        _winreg.DeleteKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\Excel\\Addins\\" + klass._reg_progid_)
    except WindowsError:
        pass 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:excelAddin.py

示例10: UnregisterAddin

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def UnregisterAddin(klass):
    import _winreg
    try:
        _winreg.DeleteKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\Outlook\\Addins\\" + klass._reg_progid_)
    except WindowsError:
        pass 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:outlookAddin.py

示例11: __delitem__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def __delitem__(self, k):
        key, subkey = self._compute_subkey(k)
        with _winreg.OpenKey(self._hive, key,
                             0, _winreg.KEY_ALL_ACCESS) as root_key:
            try:
                _winreg.DeleteValue(root_key, subkey)
            except WindowsError:
                try:
                    _winreg.DeleteKey(root_key, subkey)
                except WindowsError:
                    raise KeyError 
开发者ID:ActiveState,项目名称:code,代码行数:13,代码来源:recipe-577381.py

示例12: restore

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def restore(self, key, value=''):
        """ Restore to the last registry known state
        """
        if self.no_restore is False:
            new_sk = self.last_created['new_sk']
            k = self.last_created['key']
            exist_sk = self.last_created['existing_sk']

            self.del_value(key, value)

            if new_sk is not None:
                for i in range(len(new_sk)):
                    if i == 0:
                        try:
                            winreg.DeleteKey(k, "\\".join(exist_sk + new_sk))
                        except WindowsError as error:
                            pass
                    else:
                        try:
                            winreg.DeleteKey(k, "\\".join(
                                exist_sk + new_sk[:-i]))
                        except WindowsError as error:
                            pass

                self.last_created['new_sk'] = None
                self.last_created['existing_sk'] = None
                self.last_created['key'] = None 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:29,代码来源:winreg.py

示例13: delete_key

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def delete_key(self, key, subkey):
        """ Deletes a particular key
        """
        try:
            return winreg.DeleteKey(key, subkey)
        except WindowsError as error:
            print "Error al eliminar la clave" 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:9,代码来源:winreg.py

示例14: restore

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def restore(self, key, value=''):
        """ Restore to the last registry known state
        """
        if self.no_restore is False:
            new_sk = self.last_created['new_sk']
            k = self.last_created['key']
            exist_sk = self.last_created['existing_sk']

            self.del_value(key, value)

            if new_sk is not None:
                for i in range(len(new_sk)):
                    if i == 0:
                        try:
                            winreg.DeleteKey(k, "\\".join(exist_sk + new_sk))
                        except WindowsError as error:
                            return None
                    else:
                        try:
                            winreg.DeleteKey(k, "\\".join(
                                exist_sk + new_sk[:-i]))
                        except WindowsError as error:
                            return None

                self.last_created['new_sk'] = None
                self.last_created['existing_sk'] = None
                self.last_created['key'] = None
        return True 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:30,代码来源:ext_server_uacamola.py

示例15: delete_key

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteKey [as 别名]
def delete_key(self, key, subkey):
        """ Deletes a particular key
        """
        try:
            return winreg.DeleteKey(key, subkey)
        except WindowsError as error:
            return None 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:9,代码来源:ext_server_uacamola.py


注:本文中的_winreg.DeleteKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。