Outlook Reading Pane and Charles Petzold

I am working on a cool Outlook add-in, and it involves knowing if the Outlook Reading Pane is displayed or not and what its size is. This is an extra little challenge because the Outlook OM does not expose any info about the pane. One might guess that the Outlook View would perhaps disclose this info, but you get bupkis! There is a previewPane element in the View schema, but it is of no use when trying to figure out what is going on with the Reading Pane in the current view.

Well, this is where I turned to the Win32 API, a dangerous pass-time for a .NET coder who makes only occassional direct calls the "Charles Petzold" way (I did read his incredible book "Programming Windows 3.1" back in 1997 [I think], I found the hwnd of the Reading Pane window. Anyway, I found out a couple of interesting things. I start with the basic, obvious fact and add the others as I go.

1) The Reading Pane hwnd is there when the pane is on (duh) but...

2) The hwnd for the pane remains there when the pane is subsequently turned off in the folder where it can appear.

3) You can query this hwnd and find its children and so forth. It still thinks it is alive. It will contain all of the controls with data from the last viewed Outlook item with the pane was turned off.

3) Moving to a folder where there is no reading pane (ie: Calendar) causes the hwnd for the pane to finally go away.

4) Going back to a folder where the reading pane can appear (ie: Inbox) but where the reading pane is still off causes the hwnd for that pane to become alive again. However, it will no longer contain controls and data of the last viewed Item when it was turned off.

So, if you are in a pane where the Reading Pane can appear, it will actually be alive in memory, lurking in the background and will need to keep this in mind when writing an add-in that takes into account the Reading Pane behavior.

Second Rock Thought for the Day: I was picking up one of my sons from track practice the other day, and I pulled up with Linkin Park's Meteora CD at near full volume in my car. He loves this album as much as I do, and I am pleased that he sings the words (even though a little too quietly). Always encourage kids to sing. Rock and roll and music in general is about freedom and letting ourselves go, if only for 3.5 minutes. I've pretended to be Robert Plant rasping out the lyrics so many times, and it always feels good, and I'm not embarrassed. I'm actually more embarrassed if I hold myself back because it shows my fears (although my sense of public propriety prevents from doing my Robert Plant impressions where it will be truly annoying to others). "I don't care what the people say, I know where their jive is at."

Rock On