Windows/MFC

파일경로 축약 (GetShortPathName)

aucd29 2013. 10. 2. 17:38
[code]DWORD GetShortPathName(
LPCTSTR lpszLongPath,
LPTSTR lpszShortPath,
DWORD cchBuffer
);

CFileDialog dlg(TRUE, "raw", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
                    "RAW Files (*raw)|*.raw||", this );
if( dlg.DoModal()==IDOK )
{
    m_szFileFullPath = dlg.GetPathName();

    char strShortPath[255];
    memset(strShortPath, 0x00, sizeof(strShortPath));
    GetShortPathName((LPSTR)(LPCTSTR)m_szFileFullPath, strShortPath, 255);
    m_szFileShortPath = (CString)strShortPath;
}[/code]