File Save As from ATL (no MFC)
-
can somebody point me in the right direction? i've been assigned to do an non-MFC ATL control that requires the use of the common Save As... dialog. i know it's easy to do with MFC, but like i said.. this is a non-MFC app. any hints would be appreciated. -c
-
can somebody point me in the right direction? i've been assigned to do an non-MFC ATL control that requires the use of the common Save As... dialog. i know it's easy to do with MFC, but like i said.. this is a non-MFC app. any hints would be appreciated. -c
Use the
GetSaveFileName()
API. -
can somebody point me in the right direction? i've been assigned to do an non-MFC ATL control that requires the use of the common Save As... dialog. i know it's easy to do with MFC, but like i said.. this is a non-MFC app. any hints would be appreciated. -c
Here is a snippet of code where I am doing this OPENFILENAME OpenFileName; TCHAR szFile[MAX_PATH] = "\0"; strcpy( szFile, ""); // Fill in the OPENFILENAME structure to support a template // and hook. OpenFileName.lStructSize = sizeof(OPENFILENAME); OpenFileName.hwndOwner = NULL; OpenFileName.hInstance = NULL; OpenFileName.lpstrFilter = "Data Files\0*.DAT\0"; OpenFileName.lpstrCustomFilter = NULL; OpenFileName.nMaxCustFilter = 0; OpenFileName.nFilterIndex = 0; OpenFileName.lpstrFile = szFile; OpenFileName.nMaxFile = sizeof(szFile); OpenFileName.lpstrFileTitle = NULL; OpenFileName.nMaxFileTitle = 0; OpenFileName.lpstrInitialDir = "C:\\YourPath"; OpenFileName.lpstrTitle = "Select A File"; OpenFileName.nFileOffset = 0; OpenFileName.nFileExtension = 0; OpenFileName.lpstrDefExt = NULL; OpenFileName.lCustData = NULL; OpenFileName.lpfnHook = NULL; OpenFileName.lpTemplateName = NULL; OpenFileName.Flags = OFN_EXPLORER ; // Call the common dialog function. if (GetOpenFileName(&OpenFileName)) { strcpy(chFileName,(LPCTSTR)OpenFileName.lpstrFile); }