VSTPluginLib *CSelectPluginDlg::ScanPlugins(const mpt::PathString &path, CWnd *parent) //------------------------------------------------------------------------------------ { CVstPluginManager *pManager = theApp.GetPluginManager(); VSTPluginLib *plugLib = nullptr; bool update = false; CDialog pluginScanDlg; pluginScanDlg.Create(IDD_SCANPLUGINS, parent); pluginScanDlg.CenterWindow(parent); pluginScanDlg.ModifyStyle(0, WS_SYSMENU, WS_SYSMENU); pluginScanDlg.ShowWindow(SW_SHOW); FolderScanner scan(path, true); mpt::PathString fileName; int files = 0; while(scan.NextFile(fileName) && pluginScanDlg.IsWindowVisible()) { if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll"))) { CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT); std::wstring scanStr = L"Scanning Plugin...\n" + fileName.ToWide(); ::SetWindowTextW(text->m_hWnd, scanStr.c_str()); MSG msg; while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } VSTPluginLib *lib = pManager->AddPlugin(fileName, mpt::ustring(), false); if(lib) { update = true; if(!VerifyPlug(lib, parent)) { pManager->RemovePlugin(lib); } else { plugLib = lib; files++; } } } } if(update) { // Force selection to last added plug. Reporting::Information(mpt::String::Print("Found %1 plugin%2.", files, files == 1 ? "" : "s").c_str(), parent); return plugLib; } else { Reporting::Error("Could not find any valid VST plugins."); return nullptr; } }
///////////////////////////////////////////////////////////////////////////// // CSettingsDialog::CreatePage(const PAGE_INFO *pInfo) // Description: Create the Window of the page specified by the page info. // Return value: TRUE if successful, or FALSE if failed // BOOL CSettingsDialog::CreatePage(const PAGE_INFO *pInfo) { BOOL bCode = FALSE; if (!pInfo || !pInfo->pWnd) return(FALSE); // If no page is specified, return NULL if (!::IsWindow(pInfo->pWnd->m_hWnd)) // If the window has not yet been created, { if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CDialog))) // If the page indow is kind of dialog window { CDialog *pDlg = (CDialog*)pInfo->pWnd; bCode = pDlg->Create(pInfo->nID, this); pDlg->ModifyStyle(WS_CAPTION, 0); } else if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CWnd))) // generic CWnd derived Window { CWnd *pWnd = (CWnd*)pInfo->pWnd; bCode = CreateWnd(pInfo->pWnd); // Create Window pWnd->ModifyStyle(WS_BORDER|WS_THICKFRAME, 0); // Remoce border and thick frame styles } } return(bCode); }