• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1093
  • Last Modified:

How to put a VB6 program on Startup?

Hi,

Can anyone help me with a code to put a Visual Basic 6 program on startup.
0
mithunratnakumar
Asked:
mithunratnakumar
  • 2
  • 2
  • 2
  • +4
5 Solutions
 
DaveHurleyCommented:
Easiest way would be to paste a shortcut in the StartUp Folder on the Startmenu
0
 
senthil_msvCommented:
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



0
 
DaveHurleyCommented:
There is another way... Creating a new String Value containing the Files (EXE) full path and filename in the registry

Key Name :

HKEY_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Run

Example Program...

String Value
      Name : "QuickTime Task"
      Data : "C:\Program Files\QuickTime\qttask.exe"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Shiju SasidharanCommented:
0
 
System_ExpertCommented:
do registry entry in micro soft registry database
hkey_local/software/microsoft/windows/run/services
you will run vb6.0 automaticaly
0
 
System_ExpertCommented:
HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices
0
 
wraith821Commented:
you can set a shortcut in the startup folder in the package and deployment wizard when you create the setup.
0
 
vinnyd79Commented:

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
0
 
cybehCommented:
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
http://www.vbwire.com/advanced/howto/service.asp
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now