Howdy all,
Here's an example of what I'm trying to do. If my process has not started, then start it. If my process has started, then bring the currently running process to the front instead of opening another instance of it. For example
vb.net Code:
Private p As Process = Nothing Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If p Is Nothing OrElse p.HasExited Then p = New Process() p.StartInfo.FileName = "c:\test.txt" p.Start() Else ' This process is already running so ' bring is to the front/maximize it ' instead of opening another one. End If End Sub
I've waded through the Process class but have not found what I'm looking for. How can I, if in the example above, I already have an instance of NotePad open, bring it to the front instead of opening another instance?
Am I smelling API of some sort? Sorry if this turns out to be the inappropriate forum. Thanks.




Reply With Quote