How to put a VB6 program on Startup?


Can anyone help me with a code to put a Visual Basic 6 program on startup.
Who is Participating?
DaveHurleyConnect With a Mentor Commented:
There is another way... Creating a new String Value containing the Files (EXE) full path and filename in the registry

Key Name :


Example Program...

String Value
      Name : "QuickTime Task"
      Data : "C:\Program Files\QuickTime\qttask.exe"
Easiest way would be to paste a shortcut in the StartUp Folder on the Startmenu
Press the start menu -> Programs then Right Click and choose explore. A Program window is opened.

Goto File - > New -> Short cut -> then a wizard can comes. And choose your vb program then proced with wizard. it will create a startcut on Programs menu

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Shiju SasidharanAssoc Project ManagerCommented:
do registry entry in micro soft registry database
you will run vb6.0 automaticaly
wraith821Connect With a Mentor Commented:
you can set a shortcut in the startup folder in the package and deployment wizard when you create the setup.
vinnyd79Connect With a Mentor Commented:

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const ERROR_SUCCESS = 0&
Private Const REG_SZ = 1
Private x As Long

Private Sub SaveString(Hkey As Long, strpath As String, strValue As String, strdata As String)
    Dim keyhand As Long
    x = RegCreateKey(Hkey, strpath, keyhand)
    x = RegSetValueEx(keyhand, strValue, 0, REG_SZ, ByVal strdata, Len(strdata))
    x = RegCloseKey(keyhand)
End Sub

Private Sub Command1_Click()
Call SaveString(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", "appname", "C:\myapp.exe")
End Sub
cybehConnect With a Mentor Commented:
It depands on that you want to do. If you want your application loaded while the user login, then the above solution is good. But, if you would like your program to run as a  service (program such as schedule data backup), which means, you want the program on and running normatter is there any user login to it or which user using it (in other words, the program will on and running b4 the user login). Then try this
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.