Associated File Types

  • Thread starter Thread starter Nebo
  • Start date Start date
N

Nebo

Ok, I know this question has been asked, but the advice has just not
been very specific.

Problem: If you have a CF application associated to a file extension,
it will open your CF app and pass in the paramaters associated with
the file extension. however, if your CF App is already running, there
seems to be no way to detect a request externally to open a file.

What would be involved in getting a open CF app to respond to a
request to open a file (as in passed in command line parameters) for
associated files.

I am not asking for the code, but for the steps that will work.
 
It can't. Just like a native app can't. What you have to do is have the
new instance look to see if another instance is already running, and if it
is, pass the command line arguments to it and then exit. A reasonable way
to do this is to spawn a worker thread early on to listen for requests from
subsequent instances.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
And, of course, if you're on a device that prevents the second instance of a
program from even starting, as I think is the case on all Windows Mobile
devices, you can't do anything at all. If you want to do something even
wilder to work on that, create a launcher program that is called when the
file is tapped. This launcher will simply launch, if not already running,
the real program and send it the information on the file name that was
tapped, *then exit*. When you tap on the second file, while the first is
already open, the launcher can be executed again, since it's not already
running, and can then, as Chris suggests, notify the real program that
there's another file to be opened.

Paul T.
 
This is great advice, thanks. So have a helper application whose soul
job is to dispatch a message to the running program with information
about the file. What is the safest way to do this on WM? (TCPIP
message, is there a way to send custom window messages, or some other
reliable technique?)

Thanks for your help.
 
Back
Top