본문 바로가기

Windows/MFC

Virtual Folder

void CVirtualFolderDlg::OnBnClickedAdd()
{
    wfstream filestr;

    CString szSaveData;

    // 디렉명
    m_cboValidityDriveName.GetLBText(m_cboValidityDriveName.GetCurSel(), szSaveData);
    szSaveData += L"<>";
    szSaveData += L"\"" + m_szFullPath + L"\"\r\n";

    try
    {
        CFile fFile;
        WORD wFlag = 0xfeff;
        fFile.Open(L"./data.dat", CFile::modeWrite | CFile::modeNoTruncate);
        fFile.SeekToEnd();
        fFile.Write(&wFlag, sizeof(wFlag));
        fFile.Write(szSaveData, szSaveData.GetLength() * 2);
        m_szDB += szSaveData;
        fFile.Close();

        //
        // 생성하기
        //
        CString szCmd;
        szCmd = L"cmd.exe /c subst " + szSaveData;
        CreateDrive(szCmd);
        ReloadValidityDrive();
        SetList();
    }
    catch (CFileException& e)
    {
        e.ReportError();
        e.Delete();
    }
}

'Windows > MFC' 카테고리의 다른 글

찬찬히 보면 좋을듯  (0) 2013.10.02
CButtonEx skin 관련 fix  (0) 2013.10.02
_stat  (0) 2013.10.02
파일 크기 알기 _filelength , _fileno  (0) 2013.10.02
GetFileAttributesEx 파일크기  (0) 2013.10.02