Sorry, it *does not* use DDE (which doesn't exist in Windows CE, whether for
managed or unmanaged code). What you'd have to do is something like:
1. Create the association in the registry to trigger your application and
pass the filename on the command line.
2. Create your application so that a custom message can be sent to it,
telling it to open a new document. You'll want to use
RegisterWindowMessage() to create the message value. The easiest way I can
think of to do this is to use OpenNETCF's ApplicationEx class and to trap
the special message when it appears. When you see it, look at the string
pointed to by the lParam parameter and interpret that as the filename to be
opened.
3. When your application starts, attempt to create a named mutex. If the
creation is successful, you are the only instance running. If the creation
is unsuccessful because the mutex already exists, you are *not* the first
instance and you need to pass a custom message to the first instance. Since
you can't easily find that instance, you'll probably want to use SendMessage
and post the message to all top-level windows in the system. Set the lParam
parameter to SendMessage to a pointer to the name of the file to be opened
(you'll have to fix it in place, so that the managed environment doesn't
move it until SendMessage returns).
Given the list of things that you need to do, I wouldn't even try this in
VB.NET. Use C# and I think it should all be quite possible. Note, however,
that there is a fair amount of P/Invoking required and you really need to
know how the Windows messaging system works and how to use SendMessage, etc.
Paul T.
Bob Reader said:
I would like my application to be able to open a file whose extension is
associated with it when the user clicks on it in File Explorer. I would
like for this to work when the application is already open (I already have
it working when the application is closed).
In the non-compact world, I know that Windows Explorer uses DDE to pass
the filename in a DDE message to the already open application. It is also
my understnading that the .NET framework does not support DDE. Does this
mean that I cannot implement this feature in .NET for my Pocket PC
application? Does someone know of a way to do it?