Search Tools Links Login

Make Your Program Start Up When You Reboot


Visual Basic 6, or VB Classic

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!

Original Author: W?Å?®k?è?É_W?Ä?ú?ú??

Inputs

Just put this code in the form of your program.

Code

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:FolderBlah.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:WINDOWSStart MenuProgramsStartUp" _
& App.EXEName & ".exe"
Death:
Exit Sub
Resume Next
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 89 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.