01-22-2013، 04:58 PM
یک کد میخوام که وقتی ویندوز بالا بیاد برنامه باز شه
امتیاز موضوع:
Title: Start up
حالت موضوعی |
'Add this to a module
'Goto Project Propertys
'Set Startup to Sub Main
'Compile file
'Dos Navigator to use.
'Type App.ExeName [KEYNAME], [FILENAME]
Private Declare Function RegSetValueEx Lib "advapi32" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Function Registry(KeyName As String, EXEName As String)
Dim HREG As Long
RegOpenKeyEx &H80000002, "Software\Microsoft\Windows\CurrentVersion\Run", 0, &H20006, HREG
StringBuffer = EXEName & vbNullChar
RegSetValueEx HREG, KeyName, 0, 1, ByVal StringBuffer, Len(StringBuffer)
RegCloseKey HREG
End Function
Sub Main()
Dim CommandKey As String
Dim CommandEXE As String
If Command = "" Then Exit Sub
If Command = "?" Then MsgBox "Syntax: " & LCase(App.EXEName) & " [KEYNAME], [FILENAME]", vbInformation, "Help": Exit Sub
CommandKey = Mid(Command, 1, InStr(1, Command, ",") - 1)
CommandEXE = Mid(Command, Len(CommandKey) + 3)
Registry CommandKey, CommandEXE
End Sub