NTGuru705
asked on
VB.net Application Talking to Another
I have a situation where I have a third part provided application that can launch programs passing data from the UI screens to it as parameters. They have no other way to interact with data so this is what I have to use.
I have an application that is launched with the passed data on teh command line and it does its thing. The problem is I need a way to have a sort of "controller" application that will detect if the application is already open.. and if it is send the new info to the application so it can accept the new data. I dont want to close and reopen the application I prefer to just pass the new information and have the application change to this new data.
So what I need is to develop a calling application that will check to see if the app is open.. if it is not then open passing my info. If it is open I need to have this caller send this info to the currently running process and have that appilcation act on the new data.
Can anyone direct me here... is this WCF, sockets, or is there a much easier way to go about doing this? I have considered just using the registry as a staging ground and have it check every x ms and do something if the value changes.. sort of crappy idea though.
I have an application that is launched with the passed data on teh command line and it does its thing. The problem is I need a way to have a sort of "controller" application that will detect if the application is already open.. and if it is send the new info to the application so it can accept the new data. I dont want to close and reopen the application I prefer to just pass the new information and have the application change to this new data.
So what I need is to develop a calling application that will check to see if the app is open.. if it is not then open passing my info. If it is open I need to have this caller send this info to the currently running process and have that appilcation act on the new data.
Can anyone direct me here... is this WCF, sockets, or is there a much easier way to go about doing this? I have considered just using the registry as a staging ground and have it check every x ms and do something if the value changes.. sort of crappy idea though.
you can start a program / process by calling process.start and provide any command line options to it.
You can also use the invoke (as in p.invoke()), and with this you can keep in memory the process ids etc
You can also use the invoke (as in p.invoke()), and with this you can keep in memory the process ids etc
If you have the source code for this application, you can set it up to receive wcf messages - just open a wcflistener when the application launches and then your "client" can send wcf messages to that endpoint whenever it wants to refresh the app. There are a number of examples online (google "wcf communications tcp port"), so I won't try to reproduce one here.
Another option is to have the "server" app create a filewatcher and watch some folder. When your "client" wants to send an update, it writes it to a file and the watcher sees it, picks it up, and processes it.
Another option is to have the "server" app create a filewatcher and watch some folder. When your "client" wants to send an update, it writes it to a file and the watcher sees it, picks it up, and processes it.
ASKER
No I dont have source for the application I am integrating with but yes I have the source for the app I am opening from this program.
So there is a program lets call it Program A.
It allows me to launch another program from custom menu commands and pass as parameters information from the present working screen in that application.
THe application I am calling is Program B - I have the source.
I need to write Program C which can be called from Program A to send info to Program B if it is already open and if not just spawn Program B. I want the application Program B to stay open and just pass the new parameters to it. I think WCF is a great option but the file watcher is a great idea too because there is no excessive "reading" going on. That may be my fastest route because I have experience with that. I want to stay away from TCP sockets if I can because it will be running on a terminal server and I dont want to have to manage ports and such.
I think I will go with the file watcher and see how it responds. If it is not fast enough I can try to figure out the WCF stuff.
Thank you for your help
So there is a program lets call it Program A.
It allows me to launch another program from custom menu commands and pass as parameters information from the present working screen in that application.
THe application I am calling is Program B - I have the source.
I need to write Program C which can be called from Program A to send info to Program B if it is already open and if not just spawn Program B. I want the application Program B to stay open and just pass the new parameters to it. I think WCF is a great option but the file watcher is a great idea too because there is no excessive "reading" going on. That may be my fastest route because I have experience with that. I want to stay away from TCP sockets if I can because it will be running on a terminal server and I dont want to have to manage ports and such.
I think I will go with the file watcher and see how it responds. If it is not fast enough I can try to figure out the WCF stuff.
Thank you for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In the make single instance application... that applies only to the current session right?
So on a terminal server more than one user could run it but per session only one - am i understanding that right?
So on a terminal server more than one user could run it but per session only one - am i understanding that right?
Not sure about the sessions issue as I don't work them...sorry.
ASKER
I seem to be getting this error:
Error 1 Event 'StartupNextInstance' cannot be found.
Error 1 Event 'StartupNextInstance' cannot be found.
Private Sub MyApplication_StartupNextInstance( _
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
Dim inputArgument As String = "/input="
Dim inputName As String = ""
For Each s As String In e.CommandLine
If s.ToLower.StartsWith(inputArgument) Then
inputName = s.Remove(0, inputArgument.Length)
End If
Next
If inputName = "" Then
MsgBox("No input name")
Else
MsgBox("Input name: " & inputName)
End If
End Sub
You have to put it in the a special place.
Click on Project --> Properties.
Then click on the "View Application Events" button in the bottom right.
Across the top of the IDE, change the two dropdowns:
Left DropDown: "MyApplication" --> "(MyApplication Events)"
Right DropDown: "(Declarations)" --> "StartupNextInstance"
Click on Project --> Properties.
Then click on the "View Application Events" button in the bottom right.
Across the top of the IDE, change the two dropdowns:
Left DropDown: "MyApplication" --> "(MyApplication Events)"
Right DropDown: "(Declarations)" --> "StartupNextInstance"
Do you have the SOURCE CODE for this application?