"FileOpen"의 두 판 사이의 차이
jjuiddong
17번째 줄: | 17번째 줄: | ||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; | ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; | ||
GetOpenFileNameA(&ofn); | GetOpenFileNameA(&ofn); | ||
+ | |||
+ | -------- | ||
+ | wstring | ||
+ | |||
+ | WStrPath fileName(L"filename.txt"); | ||
+ | OPENFILENAMEW ofn; | ||
+ | ZeroMemory(&ofn, sizeof(ofn)); | ||
+ | ofn.lStructSize = sizeof(ofn); | ||
+ | ofn.hwndOwner = m_owner->getSystemHandle(); | ||
+ | ofn.lpstrFile = fileName.m_str; | ||
+ | ofn.nMaxFile = fileName.SIZE; | ||
+ | ofn.lpstrFilter = L"All\0*.*\0Text\0*.txt\0"; | ||
+ | ofn.nFilterIndex = 1; | ||
+ | |||
+ | if (!GetOpenFileNameW(&ofn)) | ||
+ | return false; |
2018년 8월 8일 (수) 10:03 기준 최신판
Open File Dialog Sample
char szFile[] = "filename.txt"; OPENFILENAMEA ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = NULL; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; GetOpenFileNameA(&ofn);
wstring
WStrPath fileName(L"filename.txt"); OPENFILENAMEW ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = m_owner->getSystemHandle(); ofn.lpstrFile = fileName.m_str; ofn.nMaxFile = fileName.SIZE; ofn.lpstrFilter = L"All\0*.*\0Text\0*.txt\0"; ofn.nFilterIndex = 1; if (!GetOpenFileNameW(&ofn)) return false;