WIn API & MFC
[WinAPI] 파일선택 다이얼로그
rex0725
2016. 6. 24. 15:13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | OPENFILENAME ofn; // common dialog box structure char szFile[MAX_PATH] = ""; // buffer for file name ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = NULL; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = _T("Avi Files(*.avi)\0*.avi\0All Files (*.*)\0*.*\0"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (::GetOpenFileName(&ofn) == false) return 0; // USE ofn.lpstrFile; | cs |