0

I am working on an outlook addin in which I need to get a handle to the "CC", "FROM" and "TO" windows in the reading pane. The approach that was taken in the addin is to use FindWindowEx WIN API and pass in the name as a parameter. But the problem is that the name must be in the UI language that outlook is using. I am trying to figure a way to get these handles without using the name, but so far no luck. I see that "TO", "FROM" and "CC" are all of the same Class ("Static"). Is there some API which will give me access to these windows without me having to use the name? Or do these windows have some ID which is independent of the language that Oultook is running in. One constraint is that the addin must work Outlook 2003 and above.

EDIT: The addin adds a button in the reading pane for each email. When clicked the current email (displayed in the reading pane) is checked and based on its contents somethings are done.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Raam
  • 10,296
  • 3
  • 26
  • 27

1 Answers1

0

Basically, what you do is NOT use the name, use the hierarchical class name structure.

I.e. the first RichEdit20WPT inside the inspector's rctrl_renwnd32\AfxWndW\AfxWndW#32770 is always the TO: field in. OL2003 and OL2010 have slightly different structures, use any decent windows spying tool to figure it out.

Paul-Jan
  • 16,746
  • 1
  • 63
  • 95
  • Thanks for the answer, I will give this a shot. So looks like Outlook does not provide any API to directly access these fields, we need to go a slight roundabout way. But I guess this is ok as the effor involved is only once per outlook release. – Raam Aug 16 '11 at 04:00
  • Well, since you asked for window handles, you have already ventured into the 'hacking' way of doing things. You didn't really say what you where going to do with those handles (modify looks? change content?), there might be a cleaner solution as well. – Paul-Jan Aug 16 '11 at 05:04
  • Hi Paul, I have updated the question with the intent of the addin. I spent quite some time researchin (I am new to addin programming) but I could not find an easy way of doing this in 2003 and 2007. I guess that this is easier with 2007 as it has a notion of regions. – Raam Aug 16 '11 at 09:12