Duilib程序中弹出文件对话框

在Duilib程序中或者Window32程序中,加载文件对话框可以通过以下代码进行加载,头文件可以百度:

void CDuiFrameWnd::OpenFileDialog()
{
    OPENFILENAME ofn;      
    TCHAR szFile[MAX_PATH] = _T("");

    ZeroMemory(&ofn, sizeof(ofn));  
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner   = *this;
    ofn.lpstrFile   = szFile;   
    ofn.nMaxFile    = sizeof(szFile);  
    ofn.lpstrFilter = STR_FILE_FILTER;
    ofn.nFilterIndex    = 1;  
    ofn.lpstrFileTitle  = NULL;  
    ofn.nMaxFileTitle   = 0;  
    ofn.lpstrInitialDir = NULL;  
    ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;  

    if (GetOpenFileName(&ofn))  
    {
        std::vector vctString(1, szFile);
    } 
}


你可能感兴趣的:(c++)