Author: gadamopoulos
Date: Wed Dec 3 17:16:53 2014
New Revision: 65555
URL:
http://svn.reactos.org/svn/reactos?rev=65555&view=rev
Log:
[EXPLORER]
- Handle TWM_DOEXITWINDOWS in CTrayWindow. This message is sent from CDesktopWindow when
it handles alt+f4 as an accelerator.
- Also handle SC_CLOSE for WM_SYSCOMMAND by calling ExitWindowsDialog.
- Fixes pressing alt+f4 in xp
- Now we have to make CDesktopWindow send TWM_DOEXITWINDOWS to the tray
Modified:
trunk/reactos/base/shell/explorer/precomp.h
trunk/reactos/base/shell/explorer/traywnd.cpp
Modified: trunk/reactos/base/shell/explorer/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precom…
==============================================================================
--- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Wed Dec 3 17:16:53 2014
@@ -159,6 +159,7 @@
*/
#define TWM_OPENSTARTMENU (WM_USER + 260)
+#define TWM_DOEXITWINDOWS (WM_USER + 342)
extern const GUID IID_IShellDesktopTray;
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywn…
==============================================================================
--- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Wed Dec 3 17:16:53 2014
@@ -2611,6 +2611,32 @@
return TRUE;
}
+ LRESULT DoExitWindows()
+ {
+ ExitWindowsDialog(m_hWnd);
+ return 0;
+ }
+
+ LRESULT OnDoExitWindows(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+ {
+ /*
+ * TWM_DOEXITWINDOWS is send by the CDesktopBrowserr to us to
+ * show the shutdown dialog
+ */
+ return DoExitWindows();
+ }
+
+ LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+ {
+ if (wParam == SC_CLOSE)
+ {
+ return DoExitWindows();
+ }
+
+ bHandled = FALSE;
+ return TRUE;
+ }
+
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LRESULT Ret = FALSE;
@@ -2675,13 +2701,7 @@
case IDM_SHUTDOWN:
{
- HINSTANCE hShell32;
- EXITWINDLG ExitWinDlg;
-
- hShell32 = GetModuleHandle(TEXT("SHELL32.DLL"));
- ExitWinDlg = (EXITWINDLG) GetProcAddress(hShell32, (LPCSTR) 60);
-
- ExitWinDlg(m_hWnd);
+ DoExitWindows();
break;
}
}
@@ -2794,6 +2814,7 @@
/*MESSAGE_HANDLER(WM_DESTROY, OnDestroy)*/
MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest)
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
+ MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand)
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
@@ -2813,6 +2834,7 @@
MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnMouseMove)
MESSAGE_HANDLER(WM_APP_TRAYDESTROY, OnAppTrayDestroy)
MESSAGE_HANDLER(TWM_OPENSTARTMENU, OnOpenStartMenu)
+ MESSAGE_HANDLER(TWM_DOEXITWINDOWS, OnDoExitWindows)
ALT_MSG_MAP(1)
END_MSG_MAP()