ChgRecycled




Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
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 HKEY_CLASSES_ROOT = &H80000000
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

'Codice della form:

'metti sulla form un pulsante e aggiungi il seguente codice

'all'evento Click

Private Sub Command1_Click()
'chiede il nuovo nome

strString$ = InputBox _
("Inserire una stringa da salvare nel registro.", "Cestino")
If strString$ = Empty Then
'La stringa e' vuota oppure e' stato premuto Annulla

MsgBox "Stringa Vuota", vbCritical, "Erroree"
Exit Sub
End If
'Chiama una API per memorizzare il nuovo nome

Call savestring _
(HKEY_CLASSES_ROOT, "CLSID\{645FF040-5081-101B-9F08-00AA002F954E}", (pre), strString$)
MsgBox "Riavvia il computer", , "I cambiamenti sono stati effettuati"
'riavvia il computer

t& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
End Sub

Cliccare con il pulsante destro del mouse sull'icona del
Cestino di Windows non ti da' l'opportunita'' di cambiare il
suo nome come avviene per altri collegamenti.

Questo tip mostra come entrare nel registro e modificare il
nome del Cestino.










( chgrecycled.html )- by Paolo Puglisi - Modifica del 17/12/2023