How would I make my application run on startup?
Printable View
How would I make my application run on startup?
I would suggest making a setup program (I use Inno Setup) and in the process you can add an option for your user to choose it to load at startup.
Brother,
You can do it by adding some New Registry Values. But I don't know how to do that. But one thing that can be done is, write some code in the main form's load event for making a shortcut link of your program, on the Startup folder of "All Users" (taking the case of CP machine only). And you can include some code for checking whether the link is existing or not. If not, then the code for creating link. Such that.. But its not a better solution, because the user needs to run your application for atleast once to work out this... :)
I think you better use some scripts of Inno Setup or any other install programs like danecook21 said... :)
You can use this StartWithWindows.bas module. In your program you would add a check box named "Start_Up" so the the user could easily enable or disable the program to start with windows.
btw I didn't write the module, forget where I got it.Code:Private Sub Form_Load()
' SET THE CHECK BOX TO SHOW THE START WITH WINDOWS STATE.
If WillRunAtStartup(App.EXEName) = True Then
Start_Up.Value = 1
Else
Start_Up.Value = 0
End If
End Sub
Private Sub Start_Up_Click()
' SET START WITH WINDOWS ON/OFF
Dim RunOnWinStart As Boolean
If Start_Up.Value = 1 Then
RunOnWinStart = True
Else
RunOnWinStart = False
End If
SetRunAtStartup App.EXEName, App.Path, RunOnWinStart
End Sub
This should not be a default setting of your application. This should be an option that can be used, or not used, by the application users.Quote:
Originally Posted by Blackbelt12
No I'm sorry, its not the default setting application. It is supposed to be a setting. I just couldn't figure out how to do it.