VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add a load= line to win.ini and copy the file that is currently running to the Windows System dir

by Max Czapski (SpEcTrE) (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sun 21st February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Add a "load=" line to win.ini and copy the file that is currently running to the Windows System directory so that it will start everytime you

API Declarations


Public Const MAX_PATH = 206
Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Public Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long

Rate Add a load= line to win.ini and copy the file that is currently running to the Windows System dir



    'Get Current Location
    Dim lngFileHandle As Long
    Dim lngReturn As Long
    Dim strFilePath As String
    strFilePath = Space$(MAX_PATH)
    lngFileHandle = GetModuleHandle(App.EXEName)
    lngReturn = GetModuleFileName(lngFileHandle, strFilePath, MAX_PATH)
    Text1.Text = strFilePath
    'Copy Server File to Windows System Directory
    If Text1.Text = a & "\SYSTEM\yourfile" Then GoTo jumpcopy
    FileCopy strFilePath, a & "\SYSTEM\yourfile"
    'Modify WIN.INI
    jumpcopy:    
    Open a & "\WIN.INI" For Input As #1
    Open a & "\WIN.ANA" For Output As #2
    While Not EOF(1)
    Input #1, b
    Print #2, Spc(0); b
    If b = "load=" & a & "\SYSTEM\yourfile" Then
    Close #1
    Close #2
    Kill a & "\WIN.ANA"
    GoTo end
    ElseIf b = "[windows]" Then
    Print #2, Spc(0); "load=" & a & "\SYSTEM\yourfile"
    Input #1, b
    End If
    Wend
    Close #1
    Close #2
    Kill a & "\WIN.INI"
    Name a & "\WIN.ANA" As a & "\WIN.INI"
    end:

Download this snippet    Add to My Saved Code

Add a load= line to win.ini and copy the file that is currently running to the Windows System dir Comments

No comments have been posted about Add a load= line to win.ini and copy the file that is currently running to the Windows System dir. Why not be the first to post a comment about Add a load= line to win.ini and copy the file that is currently running to the Windows System dir.

Post your comment

Subject:
Message:
0/1000 characters