P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Oct 10th, 2003 07:42 AM Post subject: Rename Recycle Bin |
|
|
| Code: | Public Const HKEY_CLASSES_ROOT = &H80000000
Declare Function RegCreateKey Lib "advapi32.dll" _
Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal _
lpSubKey As String, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal Hkey As Long) As Long
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
Public Const REG_SZ = 1
Public Const REG_DWORD = 4
Public Sub SaveString(Hkey As Long, strPath As _
String, strValue As String, strdata As String)
Dim keyhand As Long
Dim r As Long
r = RegCreateKey(Hkey, strPath, keyhand)
r = RegSetValueEx(keyhand, strValue, 0, _
REG_SZ, ByVal strdata, Len(strdata))
r = RegCloseKey(keyhand)
End Sub
Private Sub Command1_Click()
'prompts for new name
strString$ = InputBox("Please type in a string to save to the Registry.", "Recycle Bin")
If strString$ = Empty Then
'string is empty or cancel is pressed
MsgBox "Empty String", vbCritical, "Error"
Exit Sub
End If 'API call to store new name
Call SaveString(HKEY_CLASSES_ROOT, _
"CLSID{645FF040-5081-101B-9F08-00AA002F954E}", _
(pre), strString$)
MsgBox "Reset your PC", , "Changes are made"
End Sub |
_________________ No one is completely useless. They can at least be an example of what to avoid. |
|