title: Is there a Win32 API to monitor, location, and orientation of Taskbar "Notification Area"?
body: <p>The windows taskbar contains an area called the "Notification Area" or "system tray", where small icons appear for apps that want to run in the background and/or show system notifications. When the taskbar is on the bottom or the top of the screen, this area appears on the right.</p>
  
  <p>In multi-monitor setups, this "Notification Area" only appears on one of the taskbars, even if the taskbar is set to show on all monitors. You can control which display the Notification Area appears on by dragging the taskbar to whichever display you prefer.</p>
  
  <p>My question is:</p>
  
  <p><strong>Is there any straightforward API to find the screen, location, and orientation of the taskbar "Notification Area"?</strong></p>
  
  <p>I found one example which <a href="https://www.codeproject.com/Articles/192/Finding-the-position-and-dimensions-of-the-Windows" rel="noreferrer">searches for the Shell_TrayWnd window handle</a>, and then does math on its position try and figure out what orientation it is in (i.e. which edge of the screen the taskbar is on). </p>
  
  <p>However, this is very fragile, as it depends on the current UI design of the windows taskbar. </p>
  
  <p>Windows 10 introduced a new <a href="https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/07/08/toast-notification-and-action-center-overview-for-windows-10/" rel="noreferrer">common toast notification system</a>, including a snazzy notification flyout. However, even when you've moved the Notification Area to a different monitor, including the button which opens and closes the system notification flyout, the <a href="https://imgur.com/HNGRfyz" rel="noreferrer">flyout itself is still displayed on the "primary monitor"</a>.  </p>
  
  <p>The above suggests there might be no way to do this, as if Microsoft's own notifications don't follow the Notification Area, there may be no way to practically do so. However, Microsoft <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dn742495(v=vs.85).aspx" rel="noreferrer">documentation of the notification area</a> suggests the very sensible idea that toast should display near it.... I think they just didn't think about the multi-monitor case.</p>
  
  <p><a href="https://i.stack.imgur.com/8rpoY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8rpoY.png" alt="microsoft toast location guideline"></a></p>