-
Sep 11th, 2014, 07:20 PM
#1
Thread Starter
Hyperactive Member
Restarting my VB6 Program
I want to make my VB6 program restart(terminate->start) programatically.
Is it possible?
-
Sep 11th, 2014, 08:16 PM
#2
Re: Restarting my VB6 Program
It is possible but what circumstance do you want the program to restart itself, on some application error? You would need a way to quit the program without calling the "Restart" code incase the user wants to quit the program without restarting.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Sep 11th, 2014, 08:55 PM
#3
Re: Restarting my VB6 Program
Just start another copy with Shell and then terminate.
Or is there something more you haven't told us yet?
-
Sep 12th, 2014, 12:38 AM
#4
Junior Member
Re: Restarting my VB6 Program
Is this serious? you can fake it by making two forms, the first form will be hidden(transparent) this will call your second form (main) in restarting.
-
Sep 12th, 2014, 02:25 AM
#5
Registered User
Re: Restarting my VB6 Program
After unloading the main form reload it again
Private Sub Commantd1_Click()
Unload me
Form_Load
End Sub
-
Sep 12th, 2014, 04:45 AM
#6
Re: Restarting my VB6 Program
If I had to guess I'd think either the program has memory leaks and other issues and needs to be restarted every so often before it crashes or locks up, or else this is part of some kind of program self-update process.
Form fiddling won't help in either case, nor in many other rarer scenarios.
-
Sep 12th, 2014, 09:30 AM
#7
Re: Restarting my VB6 Program
I'm curious about the reason behind it too... because that could potentially dictate what the solution ends up being.
-tg
-
Sep 12th, 2014, 11:00 AM
#8
Thread Starter
Hyperactive Member
Re: Restarting my VB6 Program
Thanks.
It seems this is only way.
Code:
If (...) Then
Shell "MyProgram.exe"
End
End If
The reason why I try this is that there's an option to choose language in the preference of my program.
For example, if choose "French", program should be terminated and restart to read the language file and load on the memory which is to be applied to the French texts of my program.
Is there any other better way?
-
Sep 12th, 2014, 11:06 AM
#9
Re: Restarting my VB6 Program
I'd avoid the End statement and exit cleanly to avoid potential loss of data, but aside from that this might be a pretty convenient approach.
It depends on how much work it would be to just start using the new "language file" without restarting.
-
Sep 12th, 2014, 07:40 PM
#10
Lively Member
Re: Restarting my VB6 Program
Code:
Private Sub Command1_Click()
If opt1.Value = True Then
Me.Caption = "Hello"
Me.Visible = False
Call restart
ElseIf opt2.Value = True Then
Me.Caption = "Hola"
Me.Visible = False
Call restart
End If
End Sub
Sub restart()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Form1.Visible = True
End Sub
1 form
2 option button name opt1 and opt2
1 timer set value 300 ' or any value you want
You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN.
-
Sep 12th, 2014, 09:27 PM
#11
Re: Restarting my VB6 Program
That doesn't actually do anything but hide the form and then re-show it... that's not the same as restarting.
Again, until we know what the OP's intentions are, there's no point in providing any answers.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|