Search code examples
c#outlookvstooutlook-addinoffice-addins

VSTO Outlook: Get the current location of the active Outlook window (inspector or explorer)


I'm working on a VSTO Outlook Add-in and now I'm facing a particular use case where I need to get the screen location of the current active Outlook window (explorer or inspector). Sure it's not possible to use any Outlook API mechanism, but how can I do it using Windows API functions? Any code snippet will be greatly appreciated.


Solution

  • Both Explorer and Inspector Outlook Object Model objects expose the Top/Left/Width/Height properties as well as WindowState. There is no need to use Windows API to retrieve the window position.