you want your program to shut down and then reload ?
Printable View
you want your program to shut down and then reload ?
what do u mean form DOS???
i guess if u have made ur app into and .exe it should be posible!
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 Sreeves
it didn't work ... nothing happend it just shut down :confused:
Did you compile it to an exe?Quote:
Originally posted by peet
Mark Sreeves
it didn't work ... nothing happend it just shut down :confused:
yes compiled it to an exe and executed the exe
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 ...
Just Use:
VB Code:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long Public Function GetShortPath(strFileName As String) As String Dim lngRes As Long, strPath As String 'Create a buffer strPath = String$(165, 0) 'retrieve the short pathname lngRes = GetShortPathName(strFileName, strPath, 164) 'remove all unnecessary Chr$$(0)'s GetShortPath = Left$(strPath, lngRes) End Function 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, GetShortPath(App.Path) & "\" & App.EXEName Print #fNum, , "del " & fName Close #fNum Shell fName, vbHide Unload Me End Sub
Great Mark Sreeves and shragel not it works anywhere on my disk :)
thanks :)
You mis-spelled "now".
heh...always slapping you in the face with a dictionary. :D
damn !
Tat WAS a bad one :(
not(It works) => it doesn't work ?? so why am I thanking you guys ? :D
*clunk* <- peet smashes his forhead into the keyboard...
a good thing you are here eiSecure, watching my language :)
Hey, we're tied for posts: 370 each.
Wait, this counts as a post too. 370 - 371
:D :D :D
that was a cheap one ... this one on the other hand. ... :)
hey! that's cheap too!
your gonna get us both kicked out of here :)
not if you do it first! :)
well, i g2g, c ya peet
hey thats a new one "g2g" .. Still learning some usefull things :)
cya ! (god damn I'm cool) :cool:
yeah! still 2 over ya!
by the way, g2g means "got to go"
heh...even more posts...:D
No problem peet