none
How to tell when selection switches between CustomTaskPane and Outlook's Compose Inspector Window RRS feed

  • Question

  • Hi All,

    Developing an Outlook VSTO AddIn (VS2013, .NET 4.0, Office 2010/13, C#).  I'm creating a CustomTaskPane to hold my AddIn User Controls, but I need to know when the user moves between my CustomTaskPane and the Compose Inspector's main window (that contains the email body text under edit)?  Is there any way to determine which is currently selected??

    Thanks in advance for any possible pointers.

    Thanks, WordRake

    Tuesday, July 30, 2013 6:55 PM

Answers

  • Well, you're not going to get any Word events for entering and leaving the body text, and I don't know of any other Outlook events that will give you what you want. Using Win32 API calls is possible, but that is a hack. It may be your only possibility though.

    Ken Slovak MVP - Outlook

    • Marked as answer by WordRake Friday, August 9, 2013 4:43 PM
    Thursday, August 8, 2013 2:47 PM
    Moderator

All replies

  • Hi WordRake,

    I will consult my colleagues on this question and it will take some time. Your patience will be greatly appreciated.

    Regards,
    Jeffrey


    Jeffrey Chen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 31, 2013 12:32 PM
    Moderator
  • If you have a handle to that Inspector, subscribe to the Inspector's Activate() and Deactivate() events. If it's deactivated and then Activate() fires you know that focus was switched from somewhere else to the Inspector.

    Ken Slovak MVP - Outlook

    Wednesday, July 31, 2013 1:42 PM
    Moderator
  • Thanks Ken,

    I finally tried your suggestion and I don't believe that solves my problem.  I got my Activate and Deactivate handlers to fire, but they detect when the Inspector window is entered and exitted.  They do not fire when shifting between the Inspector email text part of the window, and my customtaskpane associated with that inspector window.

    Other articles that I've read seem to indicate that the only way to do what I want to do, is to handle "Window events" via the Windows API at the lowest of levels.  Not ideal.

    WordRake


    • Edited by WordRake Wednesday, August 7, 2013 8:48 PM
    Wednesday, August 7, 2013 8:47 PM
  • Well, you're not going to get any Word events for entering and leaving the body text, and I don't know of any other Outlook events that will give you what you want. Using Win32 API calls is possible, but that is a hack. It may be your only possibility though.

    Ken Slovak MVP - Outlook

    • Marked as answer by WordRake Friday, August 9, 2013 4:43 PM
    Thursday, August 8, 2013 2:47 PM
    Moderator
  • Hello WordRake,

    As Ken highlighted, there aren’t any API available from Outlook object model to meet your specific requirement.

    For more details related to TaskPane, please refer to the following article:

    Managing Custom Task Panes in Multiple Application Windows

    http://msdn.microsoft.com/en-us/library/vstudio/bb608620(v=vs.100).aspx  


    Using Win32 API to manipulate Microsoft Office Outlook windows is a possibility though unsupported.


                 The support guidelines for client-side messaging development

    http://support.microsoft.com/kb/266353

    Regards,

    Shailesh G. Rajput
    ______________________________________________
    Microsoft Developer Support - Messaging & Collaboration


    Friday, August 16, 2013 10:13 PM