Advertisement
2002ASP Miscellaneous #2215

Make Your Program Start Up When You Reboot

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!

AI

AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

소스 코드
original-source
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
원본 댓글 (3)
Wayback Machine에서 복구됨