P
pamela fluente
I have an application running. A file type is registered with this
application. When the user click on a file of such type a new instance
of the application is loaded with command line (file name).
I want to shut done this new instance an to notify the instance which
is already running, by passing the command line to it (so that the
file can be open by the application already runnning).
Here is my code, how do I notify the running instance ?
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object,
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs)
Handles Me.Startup
G_CommandLine = e.CommandLine
Dim intAppInstances As Integer =
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName))
If intAppInstances > 0 Then
MsgBox("Application already running")
' Here I want to notify the instance of the
application
'which is already running and pass to it the
CommandLine
' == how? ==
e.Cancel = True
End If
End Sub
End Class
application. When the user click on a file of such type a new instance
of the application is loaded with command line (file name).
I want to shut done this new instance an to notify the instance which
is already running, by passing the command line to it (so that the
file can be open by the application already runnning).
Here is my code, how do I notify the running instance ?
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object,
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs)
Handles Me.Startup
G_CommandLine = e.CommandLine
Dim intAppInstances As Integer =
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName))
If intAppInstances > 0 Then
MsgBox("Application already running")
' Here I want to notify the instance of the
application
'which is already running and pass to it the
CommandLine
' == how? ==
e.Cancel = True
End If
End Sub
End Class