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


Python _winreg.DeleteValue方法代码示例

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


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

示例1: unregister

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [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: enforce_shortcut

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def enforce_shortcut(config, log_func):
    if os.name != 'nt':
        return

    path = win32api.GetModuleFileName(0)

    if 'python' in path.lower():
        # oops, running the .py too lazy to make that work
        path = r"C:\Program Files\BitTorrent\bittorrent.exe"

    root_key = _winreg.HKEY_CURRENT_USER
    subkey = r'Software\Microsoft\Windows\CurrentVersion\run'
    key = _winreg.CreateKey(root_key, subkey)
    if config['launch_on_startup']:
        _winreg.SetValueEx(key, app_name, 0, _winreg.REG_SZ,
                           '"%s" --force_start_minimized' % path)
    else:
        try:
            _winreg.DeleteValue(key, app_name)
        except WindowsError, e:
            # value doesn't exist
            pass 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:24,代码来源:platform.py

示例3: cleanup

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def cleanup(base_key_full_path):
    """Performs the clean up of AltFS applicable values from the Registry"""
    hive, base_key_path = split_key_path_to_hive_and_path(base_key_full_path)
    with _winreg.OpenKey(
            HIVES[hive], base_key_path, _winreg.KEY_SET_VALUE) as base_key:
            buckets_names = get_sub_keys(base_key)

    for bucket_name in buckets_names:
        print "iterating key: %s" % bucket_name
        values_to_delete = []
        with get_bucket_key(
                HIVES[hive], "%s\\%s" % (base_key_path, bucket_name)) as key:
            for value_name in get_sub_values(key):
                print "iterating value name: %s" % value_name
                if is_value_name_applicable(buckets_names, value_name):
                    values_to_delete.append(value_name)

        with get_bucket_key(
            HIVES[hive], "%s\\%s" % (base_key_path, bucket_name),
                desired_access=_winreg.KEY_SET_VALUE) as key:
            for value_name in values_to_delete:
                print "-- going to delete: %s" % value_name
                _winreg.DeleteValue(key, value_name) 
开发者ID:SafeBreach-Labs,项目名称:AltFS,代码行数:25,代码来源:clean_registry_storage.py

示例4: __delitem__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def __delitem__(self,name):
        """Item deletion deletes key values."""
        self.sam |= KEY_SET_VALUE
        try:
            _winreg.DeleteValue(self.hkey,name)
        except WindowsError:
            raise KeyError("no such value: '%s'" % (name,)) 
开发者ID:NVDARemote,项目名称:NVDARemote,代码行数:9,代码来源:regobj.py

示例5: DllUnregisterServer

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def DllUnregisterServer():
    comclass = IEToolbar

    # unregister toolbar from internet explorer
    try:
        print "Trying to unregister Toolbar.\n"
        hkey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Internet Explorer\\Toolbar" )
        _winreg.DeleteValue( hkey, comclass._reg_clsid_ )
    except WindowsError:
        print "Couldn't delete registry value.\nhkey: %d\tCLSID: %s\n" % ( hkey, comclass._reg_clsid_ )
    else:
        print "Deleting reg key succeeded.\n"

# entry point 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:ietoolbar.py

示例6: uninstall

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def uninstall():
    if check_installed() is True:
        runkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
            r"Software\Microsoft\Windows\CurrentVersion\Run", 0,
            winreg.KEY_WRITE)
        winreg.DeleteValue(runkey, "Px")
        winreg.CloseKey(runkey)
        pprint("Px uninstalled successfully")
    else:
        pprint("Px is not installed")

    sys.exit()

###
# Attach/detach console 
开发者ID:genotrance,项目名称:px,代码行数:17,代码来源:px.py

示例7: remove

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def remove(name):
        if not exists(name):
            return

        """delete an autostart entry"""
        key = get_runonce()
        _winreg.DeleteValue(key, name)
        _winreg.CloseKey(key) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:10,代码来源:autorun.py

示例8: set_value

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def set_value(self, value_name, value):
        with winreg.CreateKeyEx(self._root, self.subkey, 0, winreg.KEY_WRITE | self._flags) as key:
            if value is None:
                winreg.DeleteValue(key, value_name)
            elif isinstance(value, str):
                winreg.SetValueEx(key, value_name, 0, winreg.REG_SZ, value)
            else:
                raise TypeError('cannot write {} to registry'.format(type(value))) 
开发者ID:sarugaku,项目名称:pythonfinder,代码行数:10,代码来源:_registry.py

示例9: _set_all_values

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def _set_all_values(self, rootkey, name, info, errors):
        with winreg.CreateKeyEx(rootkey, name, 0, winreg.KEY_WRITE | self._flags) as key:
            for k, v in info:
                if isinstance(v, PythonWrappedDict):
                    self._set_all_values(key, k, v._items(), errors)
                elif isinstance(v, dict):
                    self._set_all_values(key, k, v.items(), errors)
                elif v is None:
                    winreg.DeleteValue(key, k)
                elif isinstance(v, str):
                    winreg.SetValueEx(key, k, 0, winreg.REG_SZ, v)
                else:
                    errors.append('cannot write {} to registry'.format(type(v))) 
开发者ID:sarugaku,项目名称:pythonfinder,代码行数:15,代码来源:_registry.py

示例10: __delitem__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [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

示例11: del_value

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def del_value(self, key, value=''):
        if self.no_restore is False:
            try:
                return winreg.DeleteValue(key, value)
            except WindowsError as error:
                print "Error al eliminar el valor" 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:8,代码来源:winreg.py

示例12: del_value

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def del_value(self, key, value=''):
        if self.no_restore is False:
            try:
                return winreg.DeleteValue(key, value)
            except WindowsError as error:
                return None 
开发者ID:ElevenPaths,项目名称:uac-a-mola,代码行数:8,代码来源:ext_server_uacamola.py

示例13: _remove_registry_key

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def _remove_registry_key(value=None, name='Java-Update-Manager'):
    try:
        if _methods['registry_key'].established:
            value = _methods['registry_key'].result
            try:
                key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 0, _winreg.KEY_ALL_ACCESS)
                _winreg.DeleteValue(key, name)
                _winreg.CloseKey(key)
                return (False, None)
            except: pass
        return (_methods['registry_key'].established, _methods['registry_key'].result)
    except Exception as e:
        util.log(str(e)) 
开发者ID:malwaredllc,项目名称:byob,代码行数:15,代码来源:persistence.py

示例14: remove

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def remove(name):
        """delete an autostart entry"""
        key = get_runonce()
        _winreg.DeleteValue(key, name)
        _winreg.CloseKey(key) 
开发者ID:4n4nk3,项目名称:TinkererShell,代码行数:7,代码来源:autorun.py

示例15: write_language_file

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import DeleteValue [as 别名]
def write_language_file(lang):
    """Writes the language file.  The language file contains the
       name of the selected language, not any translations."""

    if lang != '': # system default
        get_language(lang)

    if os.name == 'nt':
        regko = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\BitTorrent")
        if lang == '':
            _winreg.DeleteValue(regko, "Language")
        else:
            lcid = None

            # I want two-way dicts
            for id, code in language.locale_sucks.iteritems():
                if code.lower() == lang.lower():
                    lcid = id
                    break
            if not lcid:
                raise KeyError(lang)

            _winreg.SetValueEx(regko, "Language", 0, _winreg.REG_SZ, str(lcid))

    else:
        lang_file_name = language_path()
        lang_file = open(lang_file_name, 'w')
        lang_file.write(lang)
        lang_file.close() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:31,代码来源:platform.py


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