In una delle pillole ho torvato questo codice, scritto da xegallo, che permette di fare partire un programma con l'avvio di windows andando a scrive un chiave nel registro.
il codice, che funziona perfettamente è questo:

codice:
'nella sezione dichiarazioni di un modulo
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
Declare Function RegCloseKey Lib "advapi32.dll" _
    (ByVal hKey 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

Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const HKEY_PERFORMANCE_DATA = &H80000004
Public Const ERROR_SUCCESS = 0&
Public Const REG_SZ = 1 
Public Const REG_DWORD = 4 

'in un modulo
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

'nella procedura che salva la voce nel registro
path = App.path & "\" & App.EXEName & ".exe"
      Call savestring(HKEY_LOCAL_MACHINE, _
        " SOFTWARE\Microsoft\Windows\CurrentVersio
n\Run", app.exename, path)
Il problema è: Come fare per cancellare da codice quella chiave nel registro?

grazie