Results 1 to 3 of 3

Thread: Toggling DWORD values in the registry

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    2

    Toggling DWORD values in the registry

    I have managed to hide the address bar in IE8 by under HKEY_CURRENT_USER>Software>Policies>Microsoft adding the keys Internet Explorer> Toolbars> Restrictions> and then a DWORD entry NoNavBar.

    If I set the DWORD value to ‘1’, hey presto, no address bar! If you then set the DWORD value back to ‘0’ the address bar re-appears.

    I would like to be able to have a button on the desktop to toggle the DWORD value between '0' and '1' and a friend suggested VB which I know nothing about.

    Anyone got any ideas?

    Thanks

  2. #2
    Member aarslan1's Avatar
    Join Date
    Dec 2010
    Location
    Canada
    Posts
    46

    Re: Toggling DWORD values in the registry

    General Declaration
    Code:
    Option Explicit
    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
    Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
    
    Private Const HKEY_CURRENT_USER = &H80000001
    Const ERROR_SUCCESS = 0&
    Const ERROR_BADDB = 1009&
    Const ERROR_BADKEY = 1010&
    Const ERROR_CANTOPEN = 1011&
    Const ERROR_CANTREAD = 1012&
    Const ERROR_CANTWRITE = 1013&
    Const ERROR_REGISTRY_RECOVERED = 1014&
    Const ERROR_REGISTRY_CORRUPT = 1015&
    Const ERROR_REGISTRY_IO_FAILED = 1016&
    Const HKEY_CLASSES_ROOT = &H80000000
    Const HKEY_LOCAL_MACHINE = &H80000002
    Const REG_SZ = 1
    
    Private Const REG_DWORD = 4
    Dim nBufferKey As Long
    Dim nVal As Long
    First Function ::

    Code:
    Sub Hide_Drive(strDrv As String)
        RegOpenKey HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\", nBufferKey
    
        RegSetValueEx nBufferKey, "NoNavBar", 0, REG_DWORD, nVal, Len(nVal)
        RegCloseKey nBufferKey
    End Sub
    Note : In Above code will add the Dword Value accordingly to what to hide the nav bar .
    Thinking And Saying Java is great because it works on All operating Systems is same as saying Anal is good because it works on all genders - By Arslan

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    2

    Re: Toggling DWORD values in the registry

    Thanks aarslan1,

    That's great!

    Paddydog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width