[EXPLORER_NEW]
[reactos.git] / reactos / base / shell / explorer-new / explorer.c
index e4e683a..c53ce77 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <precomp.h>
+#include "precomp.h"
 
 HINSTANCE hExplorerInstance;
 HMODULE hUser32;
@@ -348,6 +348,25 @@ GetVersionInfoString(IN TCHAR *szFileName,
     return bRet;
 }
 
+static VOID
+HideMinimizedWindows(IN BOOL bHide)
+{
+    MINIMIZEDMETRICS mm;
+
+    mm.cbSize = sizeof(mm);
+    if (!SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
+    {
+        DbgPrint("SystemParametersInfo failed with %lu\n", GetLastError());
+        return;
+    }
+    if (bHide)
+        mm.iArrange |= ARW_HIDE;
+    else
+        mm.iArrange &= ~ARW_HIDE;
+    if (!SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
+        DbgPrint("SystemParametersInfo failed with %lu\n", GetLastError());
+}
+
 INT WINAPI
 _tWinMain(IN HINSTANCE hInstance,
           IN HINSTANCE hPrevInstance,
@@ -382,6 +401,8 @@ _tWinMain(IN HINSTANCE hInstance,
     InitCommonControls();
     OleInitialize(NULL);
 
+    ProcessStartupItems();
+
     if (GetShellWindow() == NULL)
         CreateShellDesktop = TRUE;
 
@@ -392,6 +413,11 @@ _tWinMain(IN HINSTANCE hInstance,
         if (RegisterTrayWindowClass() && RegisterTaskSwitchWndClass())
         {
             Tray = CreateTrayWindow();
+            /* This not only hides the minimized window captions in the bottom
+               left screen corner, but is also needed in order to receive
+               HSHELL_* notification messages (which are required for taskbar
+               buttons to work right) */
+            HideMinimizedWindows(TRUE);
 
             if (Tray != NULL)
                 hShellDesktop = DesktopCreateWindow(Tray);
@@ -411,7 +437,9 @@ _tWinMain(IN HINSTANCE hInstance,
 
     if (Tray != NULL)
     {
+        RegisterHotKey(NULL, IDHK_RUN, MOD_WIN, 'R');
         TrayMessageLoop(Tray);
+        HideMinimizedWindows(FALSE);
         ITrayWindow_Release(Tray);
         UnregisterTrayWindowClass();
     }