Oppure

Loading
10/03/07 17:34
Vincent
Salve,
Ho cercato in giro per il web qualke codice sorgente ke mi permettesse di far partire una determinata esecuzione(.com o .exe) ad ogni avvio del pc,
ne ho trovato alcuni ke però facevano parte di progetti + complessi e quindi non sapevo dove mettere le mani ^^
mi potete aiutare per favore ? :d
aaa
10/03/07 18:30
Ciao

per effettuare lo Start Up, ovvero l'esecuzione di un programma all'avvio, dovresti comportarti in tale modo

inserire un Modulo, quindi un File (Bas)

con queste stringhe

Attribute VB_Name = "StartUp"

Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

Function mfncGetFromIni(strSectionHeader As String, strVariableName As String, strFileName As String) As String
Dim strReturn As String
strReturn = String(255, Chr(0))
mfncGetFromIni = Left$(strReturn, GetPrivateProfileString(strSectionHeader, ByVal strVariableName, "", strReturn, Len(strReturn), strFileName))
End Function

Function mfncWriteIni(strSectionHeader As String, strVariableName As String, strValue As String, strFileName As String) As Integer
mfncWriteIni = WritePrivateProfileString(strSectionHeader, strVariableName, strValue, strFileName)
End Function

Function WindowsDir() As String
Dim WindirS As String * 255
Dim Temp
Dim Result
Temp = GetWindowsDirectory(WindirS, 255)
Result = Left(WindirS, Temp)
WindowsDir = Result
End Function

e nel Progetto

Public Sub RegRunService(Path As String, Keyname As String)
'Ex: RegRun "/…;, "MyProgram"
Dim Reg As Object
Set Reg = CreateObject("wscript.shell";)
Reg.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUNSERVICES\" & Keyname, Path
End Sub

Spero ti sia chiaro!!!

Se ci sono dei dubbi.. POSTA!!!

B. Fine Settimana
Ultima modifica effettuata da 10/03/07 18:32
10/03/07 20:40
P4p3r0g4
Set addsta = CreateObject("WScript.Shell")
addsta.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\vb", "c:\..\file.exe", "REG_SZ"
aaa
11/03/07 1:09
Vincent
grazie mille ad entrambi (:
funziona tutto correttamente!

aaa