G
Guest
I am developing an application for Windows Mobile 6 in C#, and I'm having
trouble implementing what seems to be some fairly typical behavior.
When I'm in Word Mobile and switch to File Explorer and select a different
document, magically Word Mobile switches "context" and shows the new
document. I need to better understand the "magic."
Here is my current understanding. Windows Mobile will only allow one
instance of an app at a time. It enforces this policy at the time of window
class registration. When the second app instance tries to register a window
class, Windows Mobile says "Oh no you don't -- you are already running,"
shuts down the second instance and activates the first instance instead.
So in the Word Mobile case, the second instance somehow knows that another
instance is running, and prior to any window class registration uses some IPC
mechanism to tell the first instance to switch its context (document), then
exits.
Can anyone confirm my understanding of this?
Assuming my understanding is close to the mark, I have some questions:
1. What is the best means for determining that you are not the first
instance of your application?
2. What is the best means of communicating the new context to the first
instance? (Mailslot? Memory mapped file?)
3. Can this be done at all in a managed application? According to my
experiments, the C# main never gets executed in the second instance, leading
me to believe that the CLR does window class registration before calling
main. Can anyone confirm this?
Any insights or assistance would be greatly appreciated!
trouble implementing what seems to be some fairly typical behavior.
When I'm in Word Mobile and switch to File Explorer and select a different
document, magically Word Mobile switches "context" and shows the new
document. I need to better understand the "magic."
Here is my current understanding. Windows Mobile will only allow one
instance of an app at a time. It enforces this policy at the time of window
class registration. When the second app instance tries to register a window
class, Windows Mobile says "Oh no you don't -- you are already running,"
shuts down the second instance and activates the first instance instead.
So in the Word Mobile case, the second instance somehow knows that another
instance is running, and prior to any window class registration uses some IPC
mechanism to tell the first instance to switch its context (document), then
exits.
Can anyone confirm my understanding of this?
Assuming my understanding is close to the mark, I have some questions:
1. What is the best means for determining that you are not the first
instance of your application?
2. What is the best means of communicating the new context to the first
instance? (Mailslot? Memory mapped file?)
3. Can this be done at all in a managed application? According to my
experiments, the C# main never gets executed in the second instance, leading
me to believe that the CLR does window class registration before calling
main. Can anyone confirm this?
Any insights or assistance would be greatly appreciated!