|
-
May 7th, 2013, 11:28 AM
#1
Thread Starter
Hyperactive Member
Reboot
Hi guys,
Instead of using a .cmd file and programming to launch after xx processes, can I launch my form (Reboot form) after all other processes........
-
May 7th, 2013, 12:09 PM
#2
Re: Reboot
And again, in English ..... ?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 7th, 2013, 12:58 PM
#3
Thread Starter
Hyperactive Member
Re: Reboot
What? it's in full english and clear...
@dun, u no my project from b4, so all the installer files, i'm starting in the app as a process, now can I launch my reboot form after all processes finish?
-
May 7th, 2013, 01:30 PM
#4
Re: Reboot
Hmm, it's English but not as we know it, Jim! Anyway, to track processes ....
vb.net Code:
Dim WithEvents p As New Process With {.EnableRaisingEvents = True}
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
AddHandler p.Exited, AddressOf ProcessExit
p.StartInfo = New ProcessStartInfo("notepad")
p.Start()
End Sub
Private Sub ProcessExit(sender As Object, e As System.EventArgs)
MsgBox("Notepad gone bye-bye")
End Sub
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 7th, 2013, 02:02 PM
#5
Thread Starter
Hyperactive Member
Re: Reboot
I no how to start, stop and track, i'm launching 30+ proceess 1 after other, so how to showw reboot form after all finished.......?
-
May 7th, 2013, 02:08 PM
#6
Re: Reboot
Using the Exited events. Link all the processes to a single handler and use the sender variable to identify which have exited. Once all the processes you started are accounted for then open the form.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 7th, 2013, 02:33 PM
#7
Thread Starter
Hyperactive Member
Re: Reboot
Yay u understood, now can u help me do that, like I said i've no clue......
-
May 7th, 2013, 02:41 PM
#8
Re: Reboot
 Originally Posted by chris-2k
Yay u understood, now can u help me do that, like I said i've no clue......
It looks like Dunfiddlin provided an example of the Exited event: AddHandler p.Exited, AddressOf ProcessExit. To use the sender variable, use DirectCast or CType.
Last edited by dday9; May 7th, 2013 at 02:55 PM.
Reason: Added MSDN links
-
May 7th, 2013, 02:59 PM
#9
Thread Starter
Hyperactive Member
Re: Reboot
I do apologize m8's but i need to check if all process exited/??
Really i have no clue......
-
May 7th, 2013, 03:25 PM
#10
Re: Reboot
I'm making the following assumption:
U no how 2 tr4nsl8 2 VB
Code:
sub S()
4 x = 0 2 apps.length -1
d1m p = new proc with {.EnableRaisingEvents = tru}
+Handler p.Xited, +dressOf Yo
p.St4rt1nfo = new ProcessStartInfo(apps(x))
p.Start
nXt
end sub
sub Yo()
static c as int =0
c+=1
if c = apps.length then
doIt
end if
end sub
Gr8, give r8ings m8.
Last edited by Joacim Andersson; May 7th, 2013 at 03:31 PM.
-
May 7th, 2013, 03:29 PM
#11
Re: Reboot
vb.net Code:
Public Class Form1
' We'll assume you have all the filepaths in a listbox
' it would work the same for any other collection type
Dim pCount As Integer
Dim p() As Process
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click 'launch
pCount = ListBox1.Items.Count
ReDim p(pCount - 1)
For i = 0 To pCount - 1
p(i) = New Process With {.EnableRaisingEvents = True}
AddHandler p(i).Exited, AddressOf ProcessExit
p(i).StartInfo.FileName = ListBox1.Items(i).ToString
p(i).Start()
Next
End Sub
Private Sub ProcessExit(sender As Object, e As System.EventArgs)
pCount -= 1
If pCount = 0 Then
MsgBox("All Done")
End If
End Sub
End Class
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 7th, 2013, 03:32 PM
#12
Thread Starter
Hyperactive Member
Re: Reboot
haha sorry don't understand Joacim lol
-
May 7th, 2013, 03:33 PM
#13
Re: Reboot
 Originally Posted by Joacim Andersson
I'm making the following assumption:
U no how 2 tr4nsl8 2 VB
Code:
sub S()
4 x = 0 2 apps.length -1
d1m p = new proc with {.EnableRaisingEvents = tru}
+Handler p.Xited, +dressOf Yo
p.St4rt1nfo = new ProcessStartInfo(apps(x))
p.Start
nXt
end sub
sub Yo()
static c as int =0
c+=1
if c = apps.length then
doIt
end if
end sub
Gr8, give r8ings m8.
 
-
May 7th, 2013, 03:53 PM
#14
Thread Starter
Hyperactive Member
Re: Reboot
@dun, here's my install form, as u see no listbox, reads straight from .ini:
Code:
Public Class InstallPrograms
Dim file_name As String = "./Start/InstallCFG.ini"
Dim stream_reader As New IO.StreamReader(file_name)
Dim line As String
Dim ReadResult() As String
Sub Form1_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp
If e.KeyData = Keys.F1 Then
Editor.ShowDialog()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
line = stream_reader.ReadLine() 'Read InstallCFG.ini File
Do While Not (line Is Nothing)
ReadResult = line.Split(":") 'Split line at :
If (ReadResult(0).ToLower() = "prog name") Then
Label3.Text = "Installing " + ReadResult(1)
End If
If (ReadResult(0).ToLower() = "installer file") Then
PictureBox1.ImageLocation = ".\images\System-Working.gif"
Label3.Refresh()
Label5.Refresh()
Dim info As New System.Diagnostics.ProcessStartInfo
info.FileName = ReadResult(1) 'Open the application
Dim myProcess As New System.Diagnostics.Process
myProcess.StartInfo = info
myProcess.Start() 'Start the process
myProcess.WaitForExit() 'Wait until the process started is finished
myProcess.Close() 'Release the resources
Label5.Text = "Install Complete..."
Label5.Refresh()
System.Threading.Thread.Sleep(750)
Label5.Text = ""
Label5.Refresh()
Else
MessageBox.Show("Something is wrong! File = " & ReadResult(1))
End If
line = stream_reader.ReadLine() 'Move on to the next line.
Loop
stream_reader.Close()
End Sub
End Class
Don't worry, the stuff we/you did yesterday is in select app form
-
May 10th, 2013, 04:32 AM
#15
Re: Reboot
 Originally Posted by Joacim Andersson
I'm making the following assumption:
U no how 2 tr4nsl8 2 VB
Code:
sub S()
4 x = 0 2 apps.length -1
d1m p = new proc with {.EnableRaisingEvents = tru}
+Handler p.Xited, +dressOf Yo
p.St4rt1nfo = new ProcessStartInfo(apps(x))
p.Start
nXt
end sub
sub Yo()
static c as int =0
c+=1
if c = apps.length then
doIt
end if
end sub
Gr8, give r8ings m8.
visu4l b4sik?
-
May 10th, 2013, 09:15 AM
#16
Thread Starter
Hyperactive Member
Re: Reboot
Anyone can help me sort it?
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
|