Added a Open dialog. Right now it still opens new windows

rather than opening documents in a existing ibrowser window.

svn path=/trunk/; revision=13694
This commit is contained in:
Steven Edwards 2005-02-20 19:51:38 +00:00
parent 16a80322bb
commit 535d688d66
5 changed files with 51 additions and 0 deletions

View file

@ -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)
{

View file

@ -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).

View file

@ -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

View file

@ -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"

View file

@ -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;