Code : Tout sélectionner
; WichUser = 1 : All Users / 0 Current User
; AddOrDel = 1 : Add the "Software" in the Run Key / 0 Remove
; Return 1 if success / 0 if fail
Procedure RunProgramAtStartup(WichUser.l,AddOrDel.l,Software.s)
File.s=GetFilePart(Software)
Extension.s=GetExtensionPart(File)
Cle.s=Mid(File,1,Len(File)-Len(Extension)-1)
If WichUser=1
Key.s="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run"
Else
Key="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
EndIf
If AddOrDel
Retour=RegSetValue(Key,Cle,Software,#REG_SZ ,".")
Else
Retour=RegDeleteValue(Key,Cle,".")
EndIf
ProcedureReturn Retour
EndProcedure
;/ Test
; Add Regedit for all user @ Startup
Debug RunProgramAtStartup(1,1,"c:\windows\regedit.exe")