• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 5 رای - 2.2 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Start up
حالت خطی
#2
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:
کد:
'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
 
پاسخ
  


پیام‌های این موضوع
Start up - توسط a.adhami - 01-22-2013، 04:58 PM
RE: Start up - توسط Amin_Mansouri - 01-22-2013، 08:40 PM
RE: Start up - توسط a.adhami - 01-23-2013، 09:06 PM
RE: Start up - توسط Amin_Mansouri - 01-24-2013، 02:51 PM
RE: Start up - توسط sajad-kh - 09-14-2013، 11:08 PM

پرش به انجمن:


Browsing: 1 مهمان