Search code examples
c#winapitaskbarflyout

Disable NotifyIconOverflowWindow autohide


I have done flyout window similar to win7 battery meter. It is behaving just like built in one except when it is shown via notify icon who is located on NotifyAreaOverflowWindow aka notify overfow area that window autohides itself after some time while it should hide only when my flyout closes. The only difference that I could spot with spyxx that after some time overflow window simply sends itself an WM_SHOWWINDOW wp:0 lp:0 message.

How can I prevent the overflow window from autohiding while my flyout is active?

screenshot

  • Image 1: Test flyout shown after click on notify icon which is located on overflow area + couple seconds of user inactivity.
  • Image 2: Battery meter flyout shown by clicking on notify icon which is located in overflow area + 2 mins of user inactivity.

Solution

  • You should call

    NotifyWinEvent(EVENT_SYSTEM_MENUPOPUPSTART, Handle, OBJID_CLIENT, 0);
    

    before you show your window and call

    NotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, Handle, OBJID_CLIENT, 0);
    

    after you hide it.