Results 1 to 8 of 8

Thread: 2 quick questions

  1. #1

    Thread Starter
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    1. Is it possible to grab command line parameters. For instance if my prog is run like this : myprog.exe /uninstall

    2. How do I delete the exe the current program is running from. Like uninstall deletes itself?

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    1. see help on the "Command" function
    2. does "Kill" statement not work?

  3. #3
    Guest
    Q1:

    Use the Command function.

    Code:
    Private Sub Form_Load()
        Select Case Command
            Case "/a"
                MsgBox "Paramater = /a"
            Case "/b"
                MsgBox "Paramater = /b"
            Case Else
                MsgBox "Usage:" & vbCrLf & "/a - a" & vbCrLf & "/b - b"
        End Select
    End Sub
    Q2:

    There is no way a file can delete itself while it's running. But what you can do is create a second file. Bat files can delete themselves so you can use a bat file which will delete the program and then delete itself.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Parameters = Command$
    I'm not sure if even uninstall apps delete themselves, maybe you have to put something in win.ini that deletes your file at startup
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    I had the same prob week ago:

    make a batch file,and the batch file even delete itself
    batch file :
    Code:
    del %1
    cd..
    rd %2
    cd\
    del %3
    in vb:

    Code:
    Shell "c:\delete.bat " & "your_uninstall.exe " & "yourfolder " & "c:\delete.bat", vbHide
    It delete the uninstall, the folder that use to contain the
    uninstall and then delete the batch file.

    Be sure to put the code in the form_terminate().

    Let me know if you have trouble with this !!

  6. #6

    Thread Starter
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Thanks for command statement (couldn't remember it)

    I don't think they delete themselves.

    Win.ini is a bit outdated. Isn't there a registry function these days?

    Never used it before so you'll have to explain

    (Never programmed win 3.1)

  7. #7
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    look at my previous thread

  8. #8

    Thread Starter
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Thanks guys!

    Batch file good enough

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width