diff --git a/reactos/subsys/system/ibrowser/ibrowser.cpp b/reactos/subsys/system/ibrowser/ibrowser.cpp index a70c3d57c98..70562aaf171 100644 --- a/reactos/subsys/system/ibrowser/ibrowser.cpp +++ b/reactos/subsys/system/ibrowser/ibrowser.cpp @@ -417,7 +417,37 @@ void ibrowser_about(HWND hwndParent) { Dialog::DoModal(IDD_ABOUT_IBROWSER, WINDOW_CREATOR(ExplorerAboutDlg), hwndParent); } +void ibrowser_open(HWND hwndParent) +{ + HMODULE hShell32; + RUNFILEDLG RunFileDlg; + OSVERSIONINFO versionInfo; + WCHAR wTitle[40]; + WCHAR wText[256]; + char szTitle[40] = "Open"; + char szText[256] = "Type the Internet Address of a document or folder and IBrowser will open it for you."; + hShell32 = LoadLibrary(_T("SHELL32.DLL")); + RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D)); + + /* Show "Run..." dialog */ + if (RunFileDlg) + { + versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&versionInfo); + + if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256); + RunFileDlg(hwndParent, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY); + } + else + RunFileDlg(hwndParent, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY); + } + + FreeLibrary(hShell32); +} static void InitInstance(HINSTANCE hInstance) { diff --git a/reactos/subsys/system/ibrowser/ibrowser.h b/reactos/subsys/system/ibrowser/ibrowser.h index 39265f27dbd..48aff170270 100644 --- a/reactos/subsys/system/ibrowser/ibrowser.h +++ b/reactos/subsys/system/ibrowser/ibrowser.h @@ -214,3 +214,18 @@ extern ATOM g_hframeClass; // display explorer "About" dialog extern void ibrowser_about(HWND hwndParent); + // display explorer "open" dialog +extern void ibrowser_open(HWND hwndParent); + + // declare shell32's "Run..." dialog export function +typedef void (WINAPI* RUNFILEDLG)(HWND hwndOwner, HICON hIcon, LPCSTR lpstrDirectory, LPCSTR lpstrTitle, LPCSTR lpstrDescription, UINT uFlags); + + // + // Flags for RunFileDlg + // + +#define RFF_NOBROWSE 0x01 // Removes the browse button. +#define RFF_NODEFAULT 0x02 // No default item selected. +#define RFF_CALCDIRECTORY 0x04 // Calculates the working directory from the file name. +#define RFF_NOLABEL 0x08 // Removes the edit box label. +#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only). diff --git a/reactos/subsys/system/ibrowser/ibrowser_intres.h b/reactos/subsys/system/ibrowser/ibrowser_intres.h index ec6e1882c44..5561e456f3d 100644 --- a/reactos/subsys/system/ibrowser/ibrowser_intres.h +++ b/reactos/subsys/system/ibrowser/ibrowser_intres.h @@ -35,6 +35,7 @@ #define ID_GO_SEARCH 40008 #define ID_GO_UP 40009 #define ID_STOP 40010 +#define ID_FILE_OPEN 0xE140 #define ID_FILE_EXIT 0xE141 #define ID_HELP 0xE146 #define IDC_STATIC -1 diff --git a/reactos/subsys/system/ibrowser/ibrowser_intres.rc b/reactos/subsys/system/ibrowser/ibrowser_intres.rc index a1857e6ade3..6ca68b90b4c 100644 --- a/reactos/subsys/system/ibrowser/ibrowser_intres.rc +++ b/reactos/subsys/system/ibrowser/ibrowser_intres.rc @@ -252,6 +252,7 @@ IDM_SDIFRAME MENU PRELOAD DISCARDABLE BEGIN POPUP "&File" BEGIN + MENUITEM "&Open", ID_FILE_OPEN MENUITEM "E&xit", ID_FILE_EXIT END POPUP "&View" diff --git a/reactos/subsys/system/ibrowser/mainframe.cpp b/reactos/subsys/system/ibrowser/mainframe.cpp index dc1af6b52f7..4062bec6f76 100644 --- a/reactos/subsys/system/ibrowser/mainframe.cpp +++ b/reactos/subsys/system/ibrowser/mainframe.cpp @@ -262,6 +262,10 @@ int MainFrameBase::Command(int id, int code) CONTEXT("MainFrameBase::Command()"); switch(id) { + case ID_FILE_OPEN: + ibrowser_open(_hwnd); + break; + case ID_FILE_EXIT: SendMessage(_hwnd, WM_CLOSE, 0, 0); break;