by WÏ©kÊÐ_WΣ£ÿ (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(4 Votes)
This is to make your program start up when you reboot your computer just like other programs you see do. **Must See** Please Vote for me!
Inputs
Just put this code in the form of your program.
Private Sub Form_Load()
Dim strDir As String
Dim intDir As Integer
Dim strpath As String
intDir = Len(CurDir()) 'Gets length of Current directory
'Gets last character from CurDir() and checks if it's a strDir = Mid(CurDir(), intDir)
If strDir = "\" Then
strpath = CurDir() & App.EXEName & ".exe"
'If is in main drive like C:\ or D:\ it simply
'puts the file name, "C:\Blah.exe"
Else
strpath = CurDir() & "\" & App.EXEName & ".exe"
'If CurDir() returns no \ then its in a folder
'and will necessitate a \ inserted so that it looks like
'C:\Folder\Blah.exe and NOT like C:\FolderBlah.exe
End If
On Error GoTo Death
'Error statement allows this code to run if it is already
'in the Start Menu
FileCopy strpath, _
"C:\WINDOWS\Start Menu\Programs\StartUp\" _
& App.EXEName & ".exe"
Death:
Exit Sub
Resume Next
End Sub