Passing Messages from One Running Application to a Second Running

W

Wiz66006

We have two projects that we are trying to make work together. The first is
CEDAR a PHP web based application. The second is Falcon, a VB.Net WPF
application that produces a graphical replay of Air Traffic for the FAA.
Falcon is about 400K in size and will be deployed to 95% of the users as an
MSI install. We would like the web application to be able to start a replay
in Falcon. My current plan is to create a very small Click Once Application
that CEDAR could call. CEDAR would pass the click once application
parameters specifying the time and place of the replay for Falcon to display.
This click once application would be very small so it could be downloaded
quickly and would only be available online.

This small application would do the following:

1. Check the Windows processes to see if Falcon was running on the machine,
if so pass the information on the time and place to Falcon which would then
display the event. We do not want to start a second instance as Falcon can
display multiple replays at the same time.
2. If Falcon is not running, check the programs folder and if Falcon is
installed on the machine then shell it and pass in the time and place for the
replay.
3. If Falcon is not running and not installed then start a Click Once
Version of Falcon. This is not the preferred method of installation as
Falcon requires Oracle drivers to be installed and we could end up with an
error.

The FAA uses a very restrictive managed user environment and all users will
only have Base User Rights with .Net 3.0 installed. We do not want to deploy
Falcon as a click once unless the user does not have it installed. The
reason for this is that 400 controllers share 8 PC’s and this would require
each controller to run the click once app on each machine with there login,
with an MSI we only need one install per machine.

My question: Is this a sound way to address this issue, or is there a more
elegant solution. If this is a good solution, how do you pass messages from
one running application to another? Example code would be greatly
appreciated as I have just made the jump from VB6 to .Net 2.0 to .Net 3.0
over the 12 months.

Thanks for the help.

Dave Wismer
 
J

Jeroen Mostert

We have two projects that we are trying to make work together. The first is
CEDAR a PHP web based application. The second is Falcon, a VB.Net WPF
application that produces a graphical replay of Air Traffic for the FAA.
Falcon is about 400K in size and will be deployed to 95% of the users as an
MSI install. We would like the web application to be able to start a replay
in Falcon.

Not easy/convenient. The other way around would be a lot simpler (a desktop
application that asks for web server data).
My current plan is to create a very small Click Once Application
that CEDAR could call. CEDAR would pass the click once application
parameters specifying the time and place of the replay for Falcon to display.
This click once application would be very small so it could be downloaded
quickly and would only be available online.
This sounds like a workable solution, although I have little experience with
ClickOnce applications. I'll assume you can get this done from PHP.
This small application would do the following:

1. Check the Windows processes to see if Falcon was running on the machine,
if so pass the information on the time and place to Falcon which would then
display the event. We do not want to start a second instance as Falcon can
display multiple replays at the same time.

You'll want the ClickOnce application to do as little as possible, to keep
it simple and prevent security problems. Falcon itself can check whether
it's already running and pass data to its original instance instead. The
standard way of doing is is to create a named Mutex and acquire it on
startup; if it fails, there is another instance running. Passing data to
that can be done with any IPC technique; for .NET you could use remoting
over an IpcChannel.

As a possibly desireable side effect, this would also prevent Falcon from
launching into multiple instances when it's started from the desktop (but if
this is actually wanted, you could simply make the behavior contingent on a
switch that only the ClickOnce-application would pass).
2. If Falcon is not running, check the programs folder and if Falcon is
installed on the machine then shell it and pass in the time and place for the
replay.

This is also unnecessary. On installation, Falcon should register its
application path (HKEY_LOCAL_MACHINE\Software\Microsoft
Windows\CurrentVersion\App Paths\Falcon.exe) or add itself to the system
path. Then the ClickOnce application can just ask "falcon.exe" to launch
without having to know where it is. Requiring the application to be
installed in a specific location is clumsy.

Alternatively, steps 1 and 2 can be simplified and the entire ClickOnce
application possibly avoided by creating a file format for these settings
and giving it a nice extension (like .falcon), then registering Falcon as
the application for these files. You can then simply have users download a
Falcon replay file, and Windows will take care of opening Falcon with the
file (though you will still have to make sure only one instance runs yourself).

One problem that remains is that the ClickOnce application can only
explicitly launch Falcon if it's fully trusted, as partial trust
applications cannot explicitly launch new processes. This means clients will
be prompted, or you will have to deploy a publisher's policy to client
machines (see http://msdn2.microsoft.com/en-us/library/76e4d2xw.aspx). The
latter could be done as part of the Falcon installation, but that obviously
requires Falcon to be installed. Alternatively, you could install the
publisher policy as a separate step.
3. If Falcon is not running and not installed then start a Click Once
Version of Falcon. This is not the preferred method of installation as
Falcon requires Oracle drivers to be installed and we could end up with an
error.
If you really need this to work, then my alternative solution would be no
good, but you yourself indicate that this is not the best solution.
Nevertheless, Falcon could still handle steps 1 and 2 itself. Only if the
ClickOnce-application fails to launch Falcon at all could it try to do this.

A much more radical suggestion is to not have Falcon work as a desktop
application, but as a web application itself. You could still develop in
..NET if you use Silverlight. This might not be feasible if Falcon is
inherently desktop-based and needs a lot of local resources (or it could
just be too much work rewriting parts), but it's worth considering.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top