diff --git a/base/shell/explorer/CMakeLists.txt b/base/shell/explorer/CMakeLists.txt index 35664b5b39d..66d10755bfc 100644 --- a/base/shell/explorer/CMakeLists.txt +++ b/base/shell/explorer/CMakeLists.txt @@ -34,6 +34,6 @@ add_rc_deps(explorer.rc ${explorer_rc_deps}) add_executable(explorer ${SOURCE} explorer.rc) target_link_libraries(explorer uuid wine cpprt atl_classes) set_module_type(explorer win32gui UNICODE) -add_importlibs(explorer advapi32 gdi32 user32 comctl32 ole32 oleaut32 shell32 browseui shlwapi shdocvw version uxtheme msvcrt kernel32 ntdll) +add_importlibs(explorer setupapi advapi32 gdi32 user32 comctl32 ole32 oleaut32 shell32 browseui shlwapi shdocvw version uxtheme msvcrt kernel32 ntdll) add_pch(explorer precomp.h SOURCE) add_cd_file(TARGET explorer DESTINATION reactos FOR all) diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp index 968440b1ae4..f4a89cb41fc 100644 --- a/base/shell/explorer/traywnd.cpp +++ b/base/shell/explorer/traywnd.cpp @@ -8,6 +8,7 @@ #include "precomp.h" #include +#include #include "appbar.h" HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu); @@ -459,6 +460,9 @@ public: LRESULT DoExitWindows() { + if (SHRestricted(REST_NOCLOSE)) + return 0; + SaveState(); /* Display the ReactOS Shutdown Dialog */ @@ -728,6 +732,20 @@ public: m_StartMenuPopup->OnSelect(MPOS_CANCELLEVEL); } + VOID ShowFolder(INT csidl, BOOL bExplore) + { + SHELLEXECUTEINFOW sei = { sizeof(sei), SEE_MASK_INVOKEIDLIST }; + if (bExplore) + sei.lpVerb = L"explore"; + sei.nShow = SW_SHOWNORMAL; + sei.lpIDList = SHCloneSpecialIDList(NULL, csidl, FALSE); + if (sei.lpIDList) + { + ShellExecuteExW(&sei); + ILFree((LPITEMIDLIST)sei.lpIDList); + } + } + LRESULT HandleHotKey(DWORD id) { switch (id) @@ -740,9 +758,7 @@ public: ExecResourceCmd(IDS_HELP_COMMAND); break; case IDHK_EXPLORE: - //FIXME: We don't support this yet: - //ShellExecuteW(0, L"explore", NULL, NULL, NULL, 1); - ShellExecuteW(0, NULL, L"explorer.exe", L"/e ,", NULL, 1); + ShowFolder(CSIDL_DRIVES, TRUE); break; case IDHK_FIND: SHFindFiles(NULL, NULL); @@ -774,12 +790,24 @@ public: return 0; } + static DWORD CALLBACK EjectThreadProc(LPVOID arg) + { + CM_Request_Eject_PC(); + return 0; + } + LRESULT HandleCommand(UINT uCommand) { switch (uCommand) { case TRAYCMD_STARTMENU: - // TODO: + SetForegroundWindow(m_hWnd); +#if 0 // FIXME: This won't work + m_StartButton.SendMessage(BM_SETSTATE, TRUE, 0); + m_StartButton.SendMessage(BM_SETSTATE, FALSE, 0); +#else + m_StartButton.SendMessage(BM_CLICK, 0, 0); +#endif break; case TRAYCMD_RUN_DIALOG: HideStartMenu(); @@ -804,6 +832,9 @@ public: case TRAYCMD_DATE_AND_TIME: ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL); break; + case TRAYCMD_EJECT: + SHCreateThread(EjectThreadProc, NULL, CTF_INSIST, NULL); + break; case TRAYCMD_TASKBAR_PROPERTIES: DisplayProperties(); break; @@ -832,19 +863,23 @@ public: ExecResourceCmd(IDS_HELP_COMMAND); break; case TRAYCMD_CONTROL_PANEL: - // TODO: + if (!SHRestricted(REST_NOSETFOLDERS)) + ShowFolder(CSIDL_CONTROLS, FALSE); break; case TRAYCMD_SHUTDOWN_DIALOG: DoExitWindows(); break; case TRAYCMD_PRINTERS_AND_FAXES: - // TODO: + if (!SHRestricted(REST_NOSETFOLDERS)) + ShowFolder(CSIDL_PRINTERS, FALSE); break; case TRAYCMD_LOCK_DESKTOP: // TODO: break; case TRAYCMD_SWITCH_USER_DIALOG: - // TODO: + UpdateWindow(); + Sleep(100); + //DisconnectWindowsDialog(m_DesktopWnd); // FIXME: shell32 break; case IDM_SEARCH: case TRAYCMD_SEARCH_FILES: @@ -853,7 +888,6 @@ public: case TRAYCMD_SEARCH_COMPUTERS: SHFindComputer(NULL, NULL); break; - default: break; } diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 8251a6d9bf3..6030acdea15 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -1000,6 +1000,7 @@ BOOL WINAPI LinkWindow_UnregisterClass(_In_ DWORD dwUnused); #define TRAYCMD_TILE_V 405 #define TRAYCMD_TOGGLE_DESKTOP 407 #define TRAYCMD_DATE_AND_TIME 408 +#define TRAYCMD_EJECT 410 #define TRAYCMD_TASKBAR_PROPERTIES 413 #define TRAYCMD_MINIMIZE_ALL 415 #define TRAYCMD_RESTORE_ALL 416