From ff164b383db12a1bfd2bf3e0b507a891964238c6 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Sat, 14 Jun 2008 21:18:08 +0000 Subject: [PATCH] - Implement the code for the "Run" and "Shutdown" menu items, create stubs for the other custom commands - Replace the ROS-specific STDCALL by APIENTRY for the function prototypes svn path=/trunk/; revision=33966 --- reactos/base/shell/explorer-new/precomp.h | 14 +++++--- reactos/base/shell/explorer-new/traywnd.c | 40 ++++++++++++++++++++++- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/reactos/base/shell/explorer-new/precomp.h b/reactos/base/shell/explorer-new/precomp.h index bf8fc0efef3..b33485a358b 100644 --- a/reactos/base/shell/explorer-new/precomp.h +++ b/reactos/base/shell/explorer-new/precomp.h @@ -25,15 +25,21 @@ #include "undoc.h" /* dynamic imports due to lack of support in msvc linker libs */ -typedef INT (STDCALL *REGSHELLHOOK)(HWND, DWORD); +typedef INT (APIENTRY *REGSHELLHOOK)(HWND, DWORD); #ifdef UNICODE #define PROC_NAME_DRAWCAPTIONTEMP "DrawCaptionTempW" -typedef BOOL (STDCALL *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCWSTR, UINT); +typedef BOOL (APIENTRY *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCWSTR, UINT); #else #define PROC_NAME_DRAWCAPTIONTEMP "DrawCaptionTempA" -typedef BOOL (STDCALL *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCSTR, UINT); +typedef BOOL (APIENTRY *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCSTR, UINT); #endif -typedef HRESULT (STDCALL *SHINVDEFCMD)(HWND, IShellFolder*, LPCITEMIDLIST); +typedef HRESULT (APIENTRY *SHINVDEFCMD)(HWND, IShellFolder*, LPCITEMIDLIST); +typedef void (APIENTRY *RUNFILEDLG)(HWND, HICON, LPCWSTR, LPCWSTR, LPCWSTR, UINT); +typedef void (APIENTRY *EXITWINDLG)(HWND); +typedef HRESULT (APIENTRY *SHWINHELP)(HWND, LPWSTR, UINT, DWORD); + +/* Constants for RunFileDlg */ +#define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name. */ static ULONG __inline Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) diff --git a/reactos/base/shell/explorer-new/traywnd.c b/reactos/base/shell/explorer-new/traywnd.c index 1f9451dfa50..e42e61f1892 100644 --- a/reactos/base/shell/explorer-new/traywnd.c +++ b/reactos/base/shell/explorer-new/traywnd.c @@ -2260,7 +2260,45 @@ HandleTrayContextMenu: lParam, &Ret))) { - /* FIXME: Handle own commands */ + switch(LOWORD(wParam)) + { + /* FIXME: Handle these commands as well */ + case IDM_TASKBARANDSTARTMENU: + case IDM_SEARCH: + case IDM_HELPANDSUPPORT: + break; + + case IDM_RUN: + { + HANDLE hShell32; + RUNFILEDLG RunFileDlg; + + hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); + RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61); + + RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); + break; + } + + /* FIXME: Handle these commands as well */ + case IDM_SYNCHRONIZE: + case IDM_LOGOFF: + case IDM_DISCONNECT: + case IDM_UNDOCKCOMPUTER: + break; + + case IDM_SHUTDOWN: + { + HANDLE hShell32; + EXITWINDLG ExitWinDlg; + + hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); + ExitWinDlg = (EXITWINDLG)GetProcAddress(hShell32, (LPCSTR)60); + + ExitWinDlg(hwnd); + break; + } + } } break;