Getsavefilename()样例代码片段
Getsavefilename()样例代码片段 OPENFILENAME ofn ; TCHAR szFile[MAX_PATH] ; ZeroMemory(&ofn,sizeof(ofn)) ; ofn .lStructSize = sizeof(ofn) ; ofn .hwndOwner = m_hWnd ; ofn .lpstrFile = szFile ; ofn .lpstrFile [ 0 ] = _T( '\0' ) ; ofn .nMaxFile = sizeof(szFile) ; ofn .lpstrFilter = _T( "Text\0*.txt\0" ) ; ofn .nFilterIndex = 1 ; ofn .lpstrFileTitle = NULL ; ofn .nMaxFileTitle = 0 ; ofn .Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT ; CString strFile ; if (GetSaveFileName(&ofn)) { strFile .Format (_T( "%s" ),szFile) ; } else return ; if (strFile .Find (_T( '.' ))!= - 1 ) { strFile = strFile .Left (strFile