Disable and Enable Registry


‘close handle key
Private Declare Function RegCloseKey Lib “advapi32.dll” (byVal HKey as Long) as long

‘create new key
Private Declare Function RegCreateKey Lib “advapi32.dll” alias “RegCreateKeyA” (byVal Hkeyas long, ByVal lpSubKey as string, phkResult as long ) as long

‘save data
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

‘predefined HKCU
Private Const HKey_Current_User=&H80000001

‘save DWORD type
Private FunctionSaveDword (byVal HKey as long,byVal strPath as string,byVal strValName as string,byVal lData as long)

Dim lngRes as long
Dim lngKey as long
Dim lng as long
lng=RegCreateKey(HKey,strPath,lngKey)
lngRes=RegSetvalueEx(lngKey,strValName,0 &,4, lData, 4)
lng=RegCloseKey(lngkey)

End Funtion

Private sub cmdDisable_Click()
Call SaveDword(HKEY_Current_User,”Software\Microsoft\Windows\CurrentVersion\” & “Policies\System”,”DisableRegistryTools”,1)

msgbox (“Editor Registry nonaktif”)
end sub

Private sub cmdEnable_Click()
Call SaveDword(HKEY_Current_User,”Software\microsoft\”windows\CurrentVersion\” & “Policies\system”,”DisableRegistryTools”,0)

msgbox (“Editor Registry aktif”)
end sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s