implement Save As dialog

svn path=/trunk/; revision=30392
This commit is contained in:
Ged Murphy 2007-11-12 14:45:20 +00:00
parent 1d9f599737
commit 736f7a1dc9
2 changed files with 31 additions and 2 deletions

View file

@ -24,6 +24,30 @@
HINSTANCE hInst; HINSTANCE hInst;
static VOID
DoSaveAs(PINFO pInfo)
{
OPENFILENAME ofn;
WCHAR szFileName[MAX_PATH] = L"";
static WCHAR szFilter[] = L"Remote Desktop Files (*rdp)\0*.rdp\0";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = pInfo->hGeneralPage;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = L"rdp";
ofn.lpstrFilter = szFilter;
ofn.lpstrFile = szFileName;
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn))
{
SaveAllSettings(pInfo);
SaveRdpSettingsToFile(szFileName, pInfo->pRdpSettings);
}
}
static VOID static VOID
OnTabWndSelChange(PINFO pInfo) OnTabWndSelChange(PINFO pInfo)
{ {
@ -228,6 +252,10 @@ GeneralDlgProc(HWND hDlg,
SaveAllSettings(pInfo); SaveAllSettings(pInfo);
SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings); SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings);
break; break;
case IDC_SAVEAS:
DoSaveAs(pInfo);
break;
} }
break; break;
@ -827,7 +855,6 @@ DisplayDlgProc(HWND hDlg,
} }
static BOOL static BOOL
OnMainCreate(HWND hwnd, OnMainCreate(HWND hwnd,
PRDPSETTINGS pRdpSettings) PRDPSETTINGS pRdpSettings)
@ -835,6 +862,7 @@ OnMainCreate(HWND hwnd,
PINFO pInfo; PINFO pInfo;
TCITEMW item; TCITEMW item;
BOOL bRet = FALSE; BOOL bRet = FALSE;
HWND hUnderGry, hUnderWht;
pInfo = HeapAlloc(GetProcessHeap(), pInfo = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
@ -889,6 +917,7 @@ OnMainCreate(HWND hwnd,
&pInfo->headerbitmap); &pInfo->headerbitmap);
} }
/* setup the tabs */
pInfo->hTab = GetDlgItem(hwnd, IDC_TAB); pInfo->hTab = GetDlgItem(hwnd, IDC_TAB);
if (pInfo->hTab) if (pInfo->hTab)
{ {