win32 - record movie dialog - if user doesn't not specify a file extension add .dsm for them

This commit is contained in:
adelikat 2009-05-26 15:13:51 +00:00
parent aa2b5b75c8
commit 7253fe7775
1 changed files with 10 additions and 3 deletions

View File

@ -90,6 +90,8 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
{ {
static struct CreateMovieParameters* p = NULL; static struct CreateMovieParameters* p = NULL;
std::wstring author = L""; std::wstring author = L"";
std::string filename; //temp variable
int x; //temp vairable
switch(uMsg) switch(uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -114,7 +116,6 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
{ {
OPENFILENAME ofn; OPENFILENAME ofn;
char szChoice[MAX_PATH]={0}; char szChoice[MAX_PATH]={0};
char recordfilename[MAX_PATH];
// browse button // browse button
ZeroMemory(&ofn, sizeof(ofn)); ZeroMemory(&ofn, sizeof(ofn));
@ -127,8 +128,14 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
GetSaveFileName(&ofn); GetSaveFileName(&ofn);
strcpy(recordfilename, szChoice);
SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, recordfilename); //If user did not specify an extension, add .dsm for them
filename = szChoice;
x = filename.find_last_of(".");
if (x < 0)
filename.append(".dsm");
SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, filename.c_str());
//if(GetSaveFileName(&ofn)) //if(GetSaveFileName(&ofn))
// UpdateRecordDialogPath(hwndDlg,szChoice); // UpdateRecordDialogPath(hwndDlg,szChoice);