Results 1 to 22 of 22

Thread: restart application

  1. #1

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    you want your program to shut down and then reload ?
    -= a peet post =-

  2. #2
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    what do u mean form DOS???

    i guess if u have made ur app into and .exe it should be posible!
    Sanj

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim fNum As Integer
    Dim fName As String
    fName = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "restart.bat"
    fNum = FreeFile
    
    If Dir(fName) <> "" Then
      Kill fName
    End If
    
    Open fName For Output As fNum
    Print #fNum, App.Path & "\" & App.EXEName
    Print #fNum, , "del " & fName
    Close #fNum
    
    Shell fName, vbHide
    
    Unload Me
    
    
    End Sub
    Mark
    -------------------

  4. #4

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Mark Sreeves

    it didn't work ... nothing happend it just shut down
    -= a peet post =-

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Originally posted by peet
    Mark Sreeves

    it didn't work ... nothing happend it just shut down
    Did you compile it to an exe?
    Mark
    -------------------

  6. #6

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    yes compiled it to an exe and executed the exe
    -= a peet post =-

  7. #7

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    uh.. I'm a stupid person...

    I didn't think about the long filename issue... I placed the project and exe in a folder with long filename...

    I moved it to c:\test and everything works like a charm !!!

    thanks!

    should be aware of the long filename issue though ...
    -= a peet post =-

  8. #8
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258
    Just Use:
    VB Code:
    1. Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
    2.  
    3. Public Function GetShortPath(strFileName As String) As String
    4. Dim lngRes As Long, strPath As String
    5. 'Create a buffer
    6. strPath = String$(165, 0)
    7. 'retrieve the short pathname
    8. lngRes = GetShortPathName(strFileName, strPath, 164)
    9. 'remove all unnecessary Chr$$(0)'s
    10. GetShortPath = Left$(strPath, lngRes)
    11. End Function
    12.  
    13.  
    14. Private Sub Command1_Click()
    15. Dim fNum As Integer
    16. Dim fName As String
    17. fName = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "restart.bat"
    18. fNum = FreeFile
    19.  
    20. If Dir(fName) <> "" Then
    21.   Kill fName
    22. End If
    23.  
    24. Open fName For Output As fNum
    25. Print #fNum, GetShortPath(App.Path) & "\" & App.EXEName
    26. Print #fNum, , "del " & fName
    27. Close #fNum
    28.  
    29. Shell fName, vbHide
    30.  
    31. Unload Me
    32.  
    33.  
    34. End Sub

  9. #9

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Great Mark Sreeves and shragel not it works anywhere on my disk

    thanks
    -= a peet post =-

  10. #10
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    You mis-spelled "now".

    heh...always slapping you in the face with a dictionary.

  11. #11

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    damn !

    Tat WAS a bad one

    not(It works) => it doesn't work ?? so why am I thanking you guys ?

    *clunk* <- peet smashes his forhead into the keyboard...

    a good thing you are here eiSecure, watching my language
    -= a peet post =-

  12. #12
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    Hey, we're tied for posts: 370 each.

    Wait, this counts as a post too. 370 - 371

  13. #13

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    that was a cheap one ... this one on the other hand. ...
    -= a peet post =-

  14. #14
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    hey! that's cheap too!

  15. #15

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    your gonna get us both kicked out of here
    -= a peet post =-

  16. #16
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    not if you do it first!

  17. #17
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    well, i g2g, c ya peet

  18. #18

    Thread Starter
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hey thats a new one "g2g" .. Still learning some usefull things

    cya ! (god damn I'm cool)
    -= a peet post =-

  19. #19
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    yeah! still 2 over ya!

  20. #20
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    by the way, g2g means "got to go"

  21. #21
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    heh...even more posts...

  22. #22
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258
    No problem peet

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