當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。