SpiecsEngine
 
Loading...
Searching...
No Matches

◆ FileLibrary_OpenInExplore()

std::string Spices::FileLibrary::FileLibrary_OpenInExplore ( const char * filter,
HWND hwnd )
static

Select a file to open in explore.

Parameters
[in]filterThe file extension filter.
[in]hwndThe Windows Needs.
Returns
Returns the file path of selected file.

Definition at line 178 of file FileLibrary.cpp.

179 {
181
182 OPENFILENAMEA ofn; // common dialog box structure
183 CHAR szFile[260] = { 0 }; // if using TCHAR macros
184 // Initialize OPEN FILENAME
185 ZeroMemory(&ofn, sizeof(OPENFILENAMEA));
186 ofn.lStructSize = sizeof(OPENFILENAMEA);
187 ofn.hwndOwner = hwnd;
188 ofn.lpstrFile = szFile;
189 ofn.nMaxFile = sizeof(szFile);
190 ofn.lpstrFilter = filter;
191 ofn.nFilterIndex = 1;
192 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
193 if (GetOpenFileNameA(&ofn) == TRUE)
194 {
195 return ofn.lpstrFile;
196 }
197 return "";
198 }
#define SPICES_PROFILE_ZONE
typename detail::filter< TypeList, F >::type filter
Keep elements except filtered.
Definition TypeList.h:328