Jump to content

When to initialize/release POOM?


Guest tedp

Recommended Posts

I'm trying to figure out where to initialize POOM so I can access the Outlook database on a phone. I'm set up with a global variable for the IPOutlookApp pointer and I was figuring to initialize it in myPlugin::Initialize() and release it in the destructor for the plug-in class. What I'm finding as I step through my code is that the IPOutlookApp is uninitialized when I try to access it in myPlugin::OnEvent or other methods.

Looks to me like what I've got there ought to work but it doesn't seem to. Should I take that as a sign that my initialization is failing or that I'm doing the wrong thing by using myPlugin::Initialize()? I'm wondering if the next step for me is to put a static class in place to initialize and release the IPOutlookApp pointer.

Any comments from the more experienced out there?

Link to comment
Share on other sites

Well, it took me a while to figure this one out. Turns out that the life cycle of a plug-in looks like this:

1. home.exe loads the homescreen XML

2. home.exe fires off a seperate helper process which loads the plugin dlls and executes myPlugin::Initialize() followed by myPlugin::Save(). This allows the very CPU intensive and memory leak prone XML parsing process to be "someone else's problem" with respect to home.exe. Any plugin state that needs to be saved gets persisted in the Save() method call. The normal constructors and destructors get called as well.

3. home.exe loads the dll and calls myPlugin::Load() to retreive any plugin state saved earlier. Plugin class constructor gets called as well. Plugin message processing loop starts up...

4. Eventually the plugin gets unloaded, probably when home.exe exits upon phone shutdown. Destructors get called.

Microsoft has a nice presentation here which covers it in considerably more detail. Make sure you read the transcripts associated with the presentation too. Those are extremely helpful.

So, net-net is that I need to do any sort of POOM initialization in the constructor for the plugin class or set up a static class that does the necessary work.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.