01-22-2013، 08:40 PM
Version Compatibility: Visual Basic 6, Visual Basic 5
More information:
Add
this code to a module. (Set Startup to Sub_Main)
What this code does is read the commandline, and add the commandline to
Registry->startup... There's no error-checking, so you'll have to
type really careful. These funcs are handy for other programs you may
want to build...
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations:
code:
More information:
Add
this code to a module. (Set Startup to Sub_Main)
What this code does is read the commandline, and add the commandline to
Registry->startup... There's no error-checking, so you'll have to
type really careful. These funcs are handy for other programs you may
want to build...
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations:
کد:
'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
code:
کد:
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
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg