MFC如何建立目錄

  1. 1.    MFC只能使用CString類,它的格式化

      CString m_strFolderPath;orm

      m_strFolderPath.Format(_T("F:\\%s"),load.m_name);return

  1. 如何建立目錄

CString m_strFolderPath;格式化

        m_strFolderPath.Format(_T("F:\\%s"),load.m_name);   

 

        if(!PathIsDirectory(m_strFolderPath))

        {

            CString strMsg;

            strMsg.Format (_T("指定路徑\"%s\"不存在,是否建立?"), m_strFolderPath);

            if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)

            {

            if (!CreateDirectory(m_strFolderPath, NULL ) )

            {

            strMsg.Format(_T("建立路徑\"%s\"失敗!是否繼續?"), m_strFolderPath);

            if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)

            return;

        }

        }

        }

相關文章
相關標籤/搜索