| 241 | } |
| 242 | |
| 243 | void setupAndStart(const bool embed, |
| 244 | const char* const startDir, |
| 245 | const char* const windowTitle, |
| 246 | const uintptr_t winId, |
| 247 | const FileBrowserOptions options) |
| 248 | { |
| 249 | isEmbed = embed; |
| 250 | |
| 251 | ofn.hwndOwner = (HWND)winId; |
| 252 | |
| 253 | ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; |
| 254 | if (options.buttons.showHidden == FileBrowserOptions::kButtonVisibleChecked) |
| 255 | ofn.Flags |= OFN_FORCESHOWHIDDEN; |
| 256 | |
| 257 | ofn.FlagsEx = 0x0; |
| 258 | if (options.buttons.showPlaces == FileBrowserOptions::kButtonInvisible) |
| 259 | ofn.FlagsEx |= OFN_EX_NOPLACESBAR; |
| 260 | |
| 261 | startDirW.resize(std::strlen(startDir) + 1); |
| 262 | if (MultiByteToWideChar(CP_UTF8, 0, startDir, -1, startDirW.data(), static_cast<int>(startDirW.size()))) |
| 263 | ofn.lpstrInitialDir = startDirW.data(); |
| 264 | |
| 265 | titleW.resize(std::strlen(windowTitle) + 1); |
| 266 | if (MultiByteToWideChar(CP_UTF8, 0, windowTitle, -1, titleW.data(), static_cast<int>(titleW.size()))) |
| 267 | ofn.lpstrTitle = titleW.data(); |
| 268 | |
| 269 | uint threadId; |
| 270 | threadCancelled = false; |
| 271 | threadHandle = _beginthreadex(nullptr, 0, _run, this, 0, &threadId); |
| 272 | } |
| 273 | |
| 274 | bool cancelAndStop() |
| 275 | { |
no test coverage detected