Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1 Patch for making most windows minimizable to tray

closed-fixed
nobody
None
5
2011-06-24
2010-09-06
Simon Sobisch
No

Solving #2923057 and #2786440 (cmd.exe cannot be minimized to tray)
After some short debugging I found the reason. Some windows are minimized instead of hidden because SW_MINIMIZE needs more time than SW_HIDE and therefore in some cases SW_MINIMIZE is finished after SW_HIDE in the next line.
One solution would be to check the state and do a Sleep(5) until it's minimized (or five seconds are over), but there is a much better solution:

Simply use SW_FORCEMINIMIZE instead of SW_MINIMIZE. If I'm right this also removes the minimize animation, therefore we can remove the SW_HIDE before this line, too.

Discussion

  • Simon Sobisch
    Simon Sobisch
    2010-12-02

    Rechecked with Win7. Because of additional animations a small Sleep seems to be necessary:

    // Hide before minimizing to disable animation. Hide again because
    // minimizing may cause the window to show.
    // ShowWindow(hwnd, SW_HIDE);
    ShowWindow(hwnd, SW_FORCEMINIMIZE); // Patch by sf-mensch: SW_MINIMIZE needs more time than SW_FORCEMINIMIZE
    Sleep(100); // Patch by sf-mensch: On Win7, additional time is still needed. Because of SW_FORCEMINIMIZE 100ms seems to be enough (at least on my PC).

     
  • James Purcell
    James Purcell
    2011-06-24

    I'll include this in the next version.

     
  • James Purcell
    James Purcell
    2011-06-24

    • status: open --> closed-fixed