BOOL CWaitForConfirmationDlg::OnInitDialog() { CDialog::OnInitDialog(); SetDlgItemText (IDC__MESSAGE, m_msg); ((CStatic*) GetDlgItem (IDC_DLGICON))->SetIcon (::LoadIcon (NULL, m_pszIcon)); fsSetForegroundWindow (m_hWnd); ::SetWindowPos (m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); ApplyLanguage (); if (m_strDontAskAgainText.GetLength () != 0) SetDlgItemText (IDC_DONTASK, m_strDontAskAgainText); if (m_wait != UINT_MAX) { SetTimer (1, 1000, NULL); SetTimerText (); } GetDlgItem (IDC_DONTASK)->ShowWindow (m_bShowDontAsk ? SW_SHOW : SW_HIDE); m_bDontAsk = FALSE; return TRUE; }
LRESULT CUploadsWnd::OnCreateUploadingDialog(WPARAM, LPARAM lp) { vmsUploadSmartPtr upl = (fsUpload*) lp; upl->Release (); if (upl->dwState & US_UPLOADINGDLGISSHOWN) return 0; upl->dwState |= US_UPLOADINGDLGISSHOWN; CWnd wnd; wnd.m_hWnd = NULL; CDlgUploading *dlg = CDlgUploading::CreateInstance (upl, &wnd); dlg->ShowWindow (SW_SHOW); fsSetForegroundWindow (dlg->m_hWnd); dlg->BringWindowToTop (); dlg->SetForegroundWindow (); return 1; }
DWORD WINAPI CFlashVideoDownloadsWnd::_threadPassWebPageUrlToFlvSniffDll(LPVOID lp) { ProcWaitInfo *info = (ProcWaitInfo*) lp; LPSTR pszUrl = (LPSTR)info->lpParam1; HRESULT *phrRes = (HRESULT*)info->lpParam2; *phrRes = S_FALSE; vmsSharedData sdata ("Fdm::mem::passUrlToFlvSniffDll", FALSE, strlen (pszUrl)+1); LPSTR psz = (LPSTR)sdata.getData (); ASSERT (psz != NULL); if (!psz) { info->bWaitDone = TRUE; return 0; } strcpy (psz, pszUrl); HWND hwnd = NULL; std::vector <HWND> vWnds; do { hwnd = ::FindWindowEx (NULL, hwnd, "FdmFlvSniffDllWnd", NULL); if (hwnd) vWnds.push_back (hwnd); } while (hwnd); info->iProgress = 0; fsSetForegroundWindow (info->hwndDlg); for (size_t i = 0; i < vWnds.size (); i++) { HRESULT hr = ::SendMessage (vWnds [i], WM_COMMAND, 0, 0); if (info) { info->iProgress = 100 * (i+1) / vWnds.size (); if (hr == S_OK) { *phrRes = S_OK; info->bWaitDone = true; info = NULL; } else { if (*phrRes != S_OK) *phrRes = hr; } } } if (info) info->bWaitDone = true; return 0; }
BOOL CSpiderAddPageDlg::OnInitDialog() { CDialog::OnInitDialog(); m_task.hts.enType = HTS_ONCE; m_task.hts.last.dwHighDateTime = m_task.hts.last.dwLowDateTime = UINT_MAX; m_task.dwFlags = SCHEDULE_ENABLED; SYSTEMTIME time; GetLocalTime (&time); if (++time.wHour > 23) time.wHour = 0; time.wMinute = 0; SystemTimeToFileTime (&time, &m_task.hts.next); m_task.uWaitForConfirmation = 0; m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER)); m_btnCreateGroup.SetIcon (SICO (IDI_CREATEGROUP)); m_btnSetTime.SetIcon (SICO (IDI_SETTIME)); m_btnOutFolderSetDefault.SetIcon (SICO (IDI_SETFOLDERDEFAULT)); m_wndGroups.Fill (); m_wndGroups.SelectGroupById (_App.CreateDld_IdOfLastGrpSelected ()); CheckDlgButton (IDC_KEEP, _App.Spider_Flags () & WPDF_KEEPFOLDERSTRUCTURE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton (IDC_DONTSTOREPAGES, _App.Spider_Flags () & WPDF_DONTSTOREPAGES ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton (IDC_DELCOMPLETED, _App.Spider_Flags () & WPDF_DELCOMPLETEDDLDS ? BST_CHECKED : BST_UNCHECKED); CComboBox *pUrls = (CComboBox*) GetDlgItem (IDC_URL); for (int i = 0; i < _LastUrlFiles.GetRecordCount (); i++) pUrls->AddString (_LastUrlFiles.GetRecord (i)); if (m_strStartUrl.GetLength () == 0) { LPCSTR pszUrl = _ClipbrdMgr.Text (); if (pszUrl) { fsURL url; if (url.Crack (pszUrl) == IR_SUCCESS) m_strUrl = pszUrl; } if (m_strUrl.GetLength () == 0) m_strUrl = "http://"; } else m_strUrl = m_strStartUrl; pUrls->SetWindowText (m_strUrl); CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER); for (i = 0; i < _LastFolders.GetRecordCount (); i++) pDirs->AddString (_LastFolders.GetRecord (i)); GetDlgItem (IDC_URL)->SetFocus (); m_bOutFolderChanged = m_bGroupChanged = FALSE; ReadAutostart (); ApplyLanguage (); if (m_bReqTopMost) { fsSetForegroundWindow (m_hWnd); ::SetWindowPos (m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); } m_wndDepthSpin.SetRange (0, UD_MAXVAL); SetDlgItemInt (IDC_DEPTH, m_wpd->GetWDPS ()->iDepth); if (m_wndGroups.SelectGroupById (_App.NewDL_GroupId ())) m_bGroupChanged = TRUE; OnChangeGroups (); BuildOutFolder (); UpdateEnabled (); return TRUE; }
void mfcSetForegroundWindow (CWnd *pwnd) { fsSetForegroundWindow (pwnd->m_hWnd); pwnd->SetForegroundWindow (); pwnd->BringWindowToTop (); }