Probá así, por lo menos a mí en XP-SP3 y W7 me funciona bien
Option Explicit
'Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const HWND_BROADCAST = &HFFFF: Private Const WM_SETTINGCHANGE = &H1A
Private Sub Form_Load()
Command1.Caption = "Autorun si"
Command2.Caption = "Autorun no"
End Sub
Private Sub Command1_Click()
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun", 145, "REG_DWORD"
Set WshShell = Nothing
Call SendNotifyMessage(&HFFFF, &H1A, 0, ByVal 0)
End Sub
Private Sub Command2_Click()
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun", 181, "REG_DWORD"
Set WshShell = Nothing
Call SendNotifyMessage(&HFFFF, &H1A, 0, ByVal 0)
End Sub
S2