BOOL CSingleCtrl::Check() { CWnd *pPrevWnd = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD); ::CreateMutex(NULL, TRUE, m_sExeName.GetString()); if (GetLastError() != ERROR_ALREADY_EXISTS) return TRUE; while (pPrevWnd) { if (::GetProp(pPrevWnd->GetSafeHwnd(), m_sExeName.GetString())) { TRACE("Check: %s found\r\n", m_sExeName.GetString()); if (pPrevWnd->IsIconic()) { TRACE("Check: show it now\r\n"); pPrevWnd->ShowWindow(SW_RESTORE); } else pPrevWnd->ShowWindow(SW_NORMAL); pPrevWnd->SetForegroundWindow(); pPrevWnd->GetLastActivePopup()->SetForegroundWindow(); return FALSE; } pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT); } TRACE("Could not find previous instance main window!\r\n"); return FALSE; }
void COptionSheet::SetFinishText(LPCWSTR lpszText) { ASSERT(NULL != lpszText); if(TRUE == IsWizardMode()) { CWnd *wnd; wnd = GetDlgItem(ID_WIZFINISH); if(NULL != wnd) { wnd->SetWindowText(lpszText); wnd->ShowWindow(SW_SHOW); } wnd = GetDlgItem(ID_WIZBACK); if(NULL != wnd) { wnd->ShowWindow(SW_HIDE); } wnd = GetDlgItem(ID_WIZNEXT); if(NULL != wnd) { wnd->ShowWindow(SW_HIDE); } } }
/** * SetSourceMode * * enables / disables project path edit / button and address edit * according to source mode (m_iSource) * When called from within radio button handlers, UpdateData must * be called before to ensure that m_iSource has been set correctly. * * @param - * @return - * @exception - * @see - */ void CPropPageRestore::SetSourceMode() { BOOL bFileSystem = (m_iSource == FILE_MODE); // enable/disable project path edit, button, address edit according // to source CWnd* pWnd = GetDlgItem(IDC_BACKUP_PATH_EDIT); if(pWnd) { pWnd->EnableWindow(bFileSystem); } pWnd = GetDlgItem(IDC_BACKUP_PATH_BTN); if(pWnd) { pWnd->EnableWindow(bFileSystem); } pWnd = GetDlgItem(IDC_ADDRESS_EDIT); if(pWnd) { pWnd->EnableWindow(!bFileSystem); } int iShowCmd = bFileSystem ? SW_HIDE : SW_SHOW; pWnd = GetDlgItem(IDC_CONNECT_INFO_EDIT); if(pWnd) { pWnd->ShowWindow(iShowCmd); } pWnd = GetDlgItem(IDC_CONNECT_STATUS_EDIT); if(pWnd) { pWnd->ShowWindow(iShowCmd); } }
BOOL CDlgTreeFrame::Size() { CWnd *pBlank = GetDlgItem( IDC_BLANK ); RECT rect; SetRect( &rect, 0, 0, 0, 0 ); // Set page parent window position if ( pBlank != NULL ) m_blank.GetClientRect( &rect ); // InflateRect( &rect, -4, -4 ); // Set page window position if ( m_hpg != NULL && m_hpg->pg != NULL && ::IsWindow( m_hpg->pg->GetSafeHwnd() ) ) { // Show the blank if ( pBlank != NULL ) pBlank->ShowWindow( SW_SHOWNORMAL ); // Set the page position m_hpg->pg->ShowWindow( SW_SHOWNORMAL ); m_hpg->pg->SetWindowPos( NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE ); m_hpg->pg->RedrawWindow(); } // end if else if ( pBlank != NULL ) pBlank->ShowWindow( SW_HIDE ); return TRUE; }
void CBmpTab::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default // AfxMessageBox("dd"); //m_dwState=HTHDOWN; CRect rcItem; for(int i=0;i<m_aryItem.GetSize();i++) { CWnd *tabItemView; tabItemView=(CWnd*)((TABITEM*)m_aryItem.GetAt(i))->pVoid; if(tabItemView) tabItemView->ShowWindow(SW_HIDE); GetTabItemRect(i,&rcItem); if(rcItem.PtInRect(point)) { m_iCurrentSelect=i; if((m_aryItem.GetAt(i))!=NULL) { if(tabItemView) tabItemView->ShowWindow(SW_NORMAL); } } } Invalidate(); CStatic::OnLButtonDown(nFlags, point); }
void CPropSheet::HideButtons() { SetRedraw(FALSE); CWnd *wnd = GetDlgItem(0x3023); if (wnd) wnd->ShowWindow(SW_HIDE); wnd = GetDlgItem(0x3024); if (wnd) wnd->ShowWindow(SW_HIDE); wnd = GetDlgItem(0x3025); if (wnd) wnd->ShowWindow(SW_HIDE); wnd = GetDlgItem(IDCANCEL); if (wnd) wnd->ShowWindow(SW_HIDE); SetRedraw(TRUE); InvalidateRect(NULL,FALSE); CMenu *menu = GetSystemMenu(FALSE); if (menu) menu->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED); }
void CManageMySQL::OnBnClickedGetdata() { // TODO: 在此添加控件通知处理程序代码 for (int i = 13;i >= 0;i--) { GetDlgItem(IDC_BUTTON1 + i)->SetWindowTextA(_T("")); GetDlgItem(IDC_BUTTON1 + i)->ShowWindow(SW_HIDE); }//隐藏Button mysql_set_character_set(&my_connection, "gbk"); int res; //mysql_query(&my_connection, "create database Exam"); mysql_query(&my_connection, "use student"); //res = mysql_query(&my_connection, "SELECT * FROM `student` where (`ID`='1')"); //char query[200] = { "SELECT * FROM `message` where (`ID`= 1 )" }; char query[200] = { "SELECT * FROM `index` LIMIT 0, 1000" }; res = mysql_query(&my_connection, query); MYSQL_RES *result = mysql_store_result(&my_connection); char** sql_row = mysql_fetch_row(result); DataGuide = 0; for (GradeCount = 0;sql_row!=NULL; GradeCount++) { //int n = m_listcontrol.InsertItem(i, temp); //m_listcontrol.SetItemData(n, i); CString str; str.Format(_T("%s"), sql_row[0]); CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + GradeCount); DlgHwnd->SetWindowText(str); DlgHwnd->ShowWindow(SW_SHOW); /*m_listcontrol.SetItemText(n, 0, str); str.Format(_T("%s"), sql_row[1]); m_listcontrol.SetItemText(n, 1, str); str.Format(_T("%s"), sql_row[2]); m_listcontrol.SetItemText(n, 2, str); str.Format(_T("%s"), sql_row[3]); m_listcontrol.SetItemText(n, 3, str); str.Format(_T("%s"), sql_row[4]); m_listcontrol.SetItemText(n, 4, str); str.Format(_T("%s"), sql_row[5]); m_listcontrol.SetItemText(n, 5, str); str.Format(_T("%s"), sql_row[6]); m_listcontrol.SetItemText(n, 6, str);*/ sql_row = mysql_fetch_row(result); //free(result); } CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + GradeCount); DlgHwnd->SetWindowText(_T("+")); DlgHwnd->ShowWindow(SW_SHOW); }
void CUIDialog::_TogglePage(int page, BOOL bVisible) { if(page < 0) return; POSITION p = m_groups.FindIndex(page); if(p != NULL) { __UIGroup *pGroup = m_groups.GetAt(p); ASSERT(pGroup != NULL); POSITION p1 = pGroup->m_items.GetHeadPosition(); while(p1) { CWnd *pItem = pGroup->m_items.GetNext(p1); ASSERT(pItem != NULL); if(bVisible) pItem->ShowWindow(SW_SHOW); else pItem->ShowWindow(SW_HIDE); } if(pGroup->m_pFirst) pGroup->m_pFirst->SetFocus(); } }
void CMyTabCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here int iNewTab = GetCurSel(); if (!IsTabEnabled(iNewTab)) { SetCurSel(m_iSelectedTab); } else { TCITEM item; CWnd* pWnd; item.mask = TCIF_PARAM; //** hide the current tab --------- GetItem(m_iSelectedTab, &item); pWnd = reinterpret_cast<CWnd*> (item.lParam); ASSERT_VALID(pWnd); pWnd->ShowWindow(SW_HIDE); //** show the selected tab -------- GetItem(iNewTab, &item); pWnd = reinterpret_cast<CWnd*> (item.lParam); ASSERT_VALID(pWnd); pWnd->ShowWindow(SW_SHOW); } *pResult = 0; }
BOOL CXTabCtrl::SelectTab(int iIndex) { ASSERT(iIndex < m_arrayStatusTab.GetSize()); if (GetCurSel() == iIndex) return TRUE; //** check if the tab is enabled -------- if (m_arrayStatusTab[iIndex]) { TCITEM item; CWnd* pWnd; item.mask = TCIF_PARAM; GetItem(GetCurSel(), &item); pWnd = reinterpret_cast<CWnd*> (item.lParam); ASSERT_VALID(pWnd); pWnd->ShowWindow(SW_HIDE); SetCurSel(iIndex); GetItem(iIndex, &item); pWnd = reinterpret_cast<CWnd*> (item.lParam); ASSERT_VALID(pWnd); pWnd->ShowWindow(SW_SHOW); return TRUE; } return FALSE; }
/*virtual*/ void CMainWnd::OnMessage(CWnd* pSender, ui16 code, ui32 data) { if ( pSender == &m_wndToolBar ) { if ( code == ToWord('L', 'D') && data ) // Layout disable { CWnd* pLayout = (CWnd*)data; SendMessage( pLayout, code, 0 ); pLayout->ShowWindow( SwHide ); } if ( code == ToWord('L', 'E') && data ) // Layout enable { CWnd* pLayout = (CWnd*)data; SendMessage( pLayout, code, 0 ); pLayout->ShowWindow( SwShow ); } if ( code == ToWord('L', 'R') ) // Layout reset { Invalidate(); } } /* if ( pSender == NULL && code == WmBroadcast && data == ToWord('d', 'g') ) { if ( m_wndGraph.m_dwFlags & WsVisible ) m_wndGraph.Invalidate(); else if ( m_wndSpectrumGraph.m_dwFlags & WsVisible ) m_wndSpectrumGraph.Invalidate(); else if ( GetFocus() != this ) SendMessage( GetFocus(), code, data ); } */ }
void CNavPaneWnd::UpdateTabContents() { CRect rcContents = ::GetClientRect(this); rcContents.DeflateRect(s_nTabsWidth + s_nLeftMargin + 1, s_nTopMargin, 0, 0); CRect rcBordered(rcContents); rcBordered.DeflateRect(1, 1, 0, 0); for (size_t i = 0; i < m_tabs.size(); ++i) { CWnd* pWnd = m_tabs[i].pWnd; const CRect& rc = (m_tabs[i].bHasBorder ? rcBordered : rcContents); m_tabs[i].rcContent = rc; if (i == m_nActiveTab) { if (rc.Height() <= 0 || rc.Width() <= 0) { pWnd->ShowWindow(SW_HIDE); } else { pWnd->SetWindowPos(NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOACTIVATE); pWnd->ShowWindow(SW_SHOW); } } } }
BOOL CDlgTreeFrame::SetPage(HTPAGE hpg) { // Sanity checks if ( hpg == NULL ) return FALSE; // Lose current page if ( m_hpg != NULL && m_hpg->pg != NULL && IsWindow( m_hpg->pg->GetSafeHwnd() ) ) { // Hide the page m_hpg->pg->ShowWindow( SW_HIDE ); } // end if // Get a pointer to the help button CWnd *pHelp = GetDlgItem( IDC_PLEASEHELP ); // Enable / Disable help button if ( pHelp != NULL ) { // Show help button if help file if ( hpg != NULL && hpg->help[ 0 ] != NULL ) { pHelp->ShowWindow( SW_SHOWNORMAL ); // Disable button if file not available char link[ CWF_STRSIZE ]; CWinFile::BuildPath( link, m_helproot, hpg->help ); pHelp->EnableWindow( CWinFile::DoesExist( link ) ); } // end if // Is there a link else if ( hpg != NULL && hpg->hlink[ 0 ] != NULL ) pHelp->EnableWindow( TRUE ); // Hide help button if no help else pHelp->ShowWindow( SW_HIDE ); } // end if if ( hpg != NULL && hpg->pg != NULL ) { // Create dialog if needed if ( !::IsWindow( hpg->pg->GetSafeHwnd() ) ) hpg->pg->Create( hpg->idd, &m_blank ); } // end if // Save current page m_hpg = hpg; m_dwLastPage = m_hpg->index; // Size everything Size(); return TRUE; }
void CMonitorWnd::UpdateWnd() { if(!IsWindowVisible() || IsIconic()) { return; } CRect rectContainer; GetClientRect(&rectContainer); GetShowRect(&rectContainer); // rectContainer.DeflateRect(1,1); if(m_bAutoAdjustPos) { AdjustRect(&rectContainer); } if(m_bMultiScreen) { CRect rect; int nCount = m_PageList.GetCount(); int i = 0; for(POSITION pos = m_PageList.GetHeadPosition(); pos != NULL; i++) { CWnd *pWnd = m_PageList.GetNext(pos); rect = rectContainer; CalcPageRect(&rect, i, nCount); rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE); // 窗口之间的间隔 pWnd->MoveWindow(&rect); pWnd->ShowWindow(SW_SHOW); } } else { for(POSITION pos = m_PageList.GetHeadPosition(); pos!=NULL;) { CWnd *pWnd = m_PageList.GetNext(pos); if(pWnd == m_pActivePage) { CRect rect = rectContainer; rect.DeflateRect(WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE, WINDOW_PAGE_SPACE); pWnd->MoveWindow(&rect); pWnd->ShowWindow(SW_SHOW); } else { pWnd->MoveWindow(rectContainer.right+1, rectContainer.bottom+1, 1, 1); // pWnd->ShowWindow(SW_HIDE); } } } if(m_bDrawActive && m_PageList.GetCount() > 1) { DrawActivePage(TRUE); } }
void CWaitDlg::AllowCancel( bool enable ) { // this shows or hides the Cancel button CWnd* pCancelButton = GetDlgItem (IDCANCEL); ASSERT (pCancelButton); if ( enable ) { pCancelButton->ShowWindow (SW_NORMAL); } else { pCancelButton->ShowWindow (SW_HIDE); } }
void ArxDbgUtils::hideDlgItem(CWnd* parentWnd, UINT resId, BOOL hideIt) { CWnd* dlgItem = parentWnd->GetDlgItem(resId); ASSERT(dlgItem != NULL); if (dlgItem) { if (hideIt) dlgItem->ShowWindow(SW_HIDE); else dlgItem->ShowWindow(SW_SHOW); } }
LRESULT CPgRect::OnRefresh(WPARAM wParam, LPARAM lParam) { LPFX pfx = EDIT().GetEditFx(); if ( pfx == NULL ) return -1; CWnd *pBck = GetDlgItem( IDC_BCK ); if ( pBck != NULL ) { if ( pfx->type == FXTYPE_RECT ) { pBck->EnableWindow( FALSE ); pBck->ShowWindow( SW_HIDE ); } // end if else { pBck->EnableWindow( TRUE ); m_bBck = ( pfx->f1 & FXF1_BCK ) != 0; } // end else } // end if CWnd *pTrans = GetDlgItem( IDC_TRANSLUCENCY ); CWnd *pTText = GetDlgItem( IDC_TTEXT ); { if ( pfx->type == FXTYPE_TEXT || pfx->type == FXTYPE_TIME || pfx->type == FXTYPE_DATE || pfx->type == FXTYPE_SCREENSHOT || pfx->type == FXTYPE_VIDEO || pfx->type == FXTYPE_URL ) { pTrans->EnableWindow( TRUE ); pTText->EnableWindow( TRUE ); char num[ 64 ]; sprintf( num, "%.2f", ( (double)pfx->translucency ) / ( (double)100 ) ); m_sTranslucency = num; } // end else else { pTrans->EnableWindow( FALSE ); pTrans->ShowWindow( SW_HIDE ); pTText->EnableWindow( FALSE ); pTText->ShowWindow( SW_HIDE ); } // end if } // end if m_colorbox.SetColor( pfx->bck ); m_bBorder = ( pfx->f1 & FXF1_BORDER ) != 0; m_bFoundered = ( pfx->f1 & FXF1_FOUNDERED ) != 0; UpdateData( FALSE ); DoEnable(); return 0; }
BOOL CSkin::CreateToolBar(LPCTSTR pszName, CCoolBarCtrl* pBar) { if ( pszName == NULL ) return FALSE; for ( CWnd* pChild = pBar->GetWindow( GW_CHILD ) ; pChild ; pChild = pChild->GetNextWindow() ) { pChild->ShowWindow( SW_HIDE ); } pBar->SetWatermark( NULL ); pBar->Clear(); CCoolBarCtrl* pBase = NULL; CString strName( pszName ); m_pToolbars.Lookup( strName, (void*&)pBase ); if ( pBase != NULL ) { pBar->Copy( pBase ); return TRUE; } else { return FALSE; } }
BOOL CClientDlg::OnInitDialog() { CDialog::OnInitDialog(); // 0 полная версия // 1 урезанная #define FullVersion #define NoHideJava #ifdef FullVersion pMenu.LoadMenuW(IDR_MENU1); #else pMenu.LoadMenuW(IDR_MENU2); CWnd* pCwnd = GetDlgItem(IDC_DConfig); pCwnd->ShowWindow(SW_HIDE); CWnd* pCwnd1 = GetDlgItem(IDC_SS); pCwnd1->ShowWindow(SW_HIDE); #endif SetMenu(&pMenu); hF4 = LoadAccelerators( AfxGetResourceHandle(), MAKEINTRESOURCE( IDR_ACCELERATOR1 ) ); m_TextWinList1.SetItemHeight(10); m_TextWinList1.SetBg(RGB(50, 100, 150)); m_TextWinList1.SetFg(RGB(255, 255,255)); m_PlaceKeeper.Init( m_hWnd ); m_PlaceKeeper.SetBindings( IDC_CLIENTVIEW, CRect( TA_LEFT, TA_TOP, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_LOG_LIST, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_WINDOW_LIST, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_LIST1, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_REFRESH_BTN, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_REFRESHWND_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_PROCDLG_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_HOOK_APP, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_HOOK_JAVA, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_PATCH_STATUS, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_STATUS, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_STATIC1, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_STATIC2, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) ); m_PlaceKeeper.SetBindings( IDC_CMD_DESK_1, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_CMD_DESK_2, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_PlaceKeeper.SetBindings( IDC_STATIC_DESK, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) ); m_pClient->SetClientNotifyWindow( m_hWnd ); m_pClient->RequestWindowList(); m_ClientView.ClearImage(); /*CButton *chB_HookJava = (CButton *) (this->GetDlgItem(IDC_HOOK_JAVA)); chB_HookJava->SetCheck(1);*/ Log( L"Getting windows..." ); #ifdef WITHOUT_VNC pMenu.DeleteMenu(5, MF_BYPOSITION); //CMenu* RDP = pMenu.GetSubMenu(5); //RDP->DeleteMenu(9, MF_BYPOSITION); //RDP->DeleteMenu(9, MF_BYPOSITION); #endif return TRUE; }
//************************************************************************************** BOOL CBCGPWindowsManagerDlg::OnInitDialog() { CBCGPDialog::OnInitDialog(); if (AfxGetMainWnd () != NULL && (AfxGetMainWnd ()->GetExStyle () & WS_EX_LAYOUTRTL)) { ModifyStyleEx (0, WS_EX_LAYOUTRTL); } FillWindowList(); // If no MDI actions are availible, hide all MDI-related buttons: if (!m_bMDIActions) { GetDlgItem(IDC_BCGBARRES_TILEHORZ)->ShowWindow (SW_HIDE); GetDlgItem(IDC_BCGBARRES_TILEVERT)->ShowWindow (SW_HIDE); GetDlgItem(IDC_BCGBARRES_CASCADE)->ShowWindow (SW_HIDE); GetDlgItem(IDC_BCGBARRES_MINIMIZE)->ShowWindow (SW_HIDE); } SelActive(); UpdateButtons(); CWnd* pBtnHelp = GetDlgItem (ID_HELP); if (pBtnHelp != NULL) { pBtnHelp->ShowWindow (m_bHelpButton ? SW_SHOW : SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
//新增在切换页面时,若将tab大小改变,内部视图也随之变化,填充满tab控件的视图区 void CTabPage::ShowCurPage(UINT nShowState) { int nCurItem; TCITEM itemCur; nCurItem = GetCurSel(); itemCur.mask = TCIF_PARAM; GetItem(nCurItem, &itemCur); CWnd* pWnd = (CWnd*)itemCur.lParam; CRect rect; //获取标签页的坐标 this->GetItemRect(0,&rect); int nLeft = rect.left; int nTop = rect.bottom; //获取整个tab窗口坐标 this->GetWindowRect(&rect); ScreenToClient(&rect); //将标签页以下的坐标作为起始位置 rect.left = nLeft; rect.top = nTop; pWnd->MoveWindow(&rect); pWnd->ShowWindow(nShowState); }
BOOL CCeWatchSheetInsVar::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); CWnd* pOk = GetDlgItem(IDOK); CWnd* pApply = GetDlgItem(ID_APPLY_NOW); CWnd* pCancel = GetDlgItem(IDCANCEL); ASSERT(pOk != NULL); ASSERT(pApply != NULL); ASSERT(pCancel != NULL); // hide OK buttton // rename Cancel and Apply button if (pOk && pCancel && pApply) { pOk->ShowWindow(SW_HIDE); CString str; str.LoadString(IDS_CLOSE); pCancel->SetWindowText(str); str.LoadString(IDS_ADD); pApply->SetWindowText(str); } return bResult; }
BOOL CDialog::OnInitDialog() { // execute dialog RT_DLGINIT resource BOOL bDlgInit; if (m_lpDialogInit != NULL) bDlgInit = ExecuteDlgInit(m_lpDialogInit); else bDlgInit = ExecuteDlgInit(m_lpszTemplateName); if (!bDlgInit) { TRACE0("Warning: ExecuteDlgInit failed during dialog init.\n"); EndDialog(-1); return FALSE; } // transfer data into the dialog from member variables if (!UpdateData(FALSE)) { TRACE0("Warning: UpdateData failed during dialog init.\n"); EndDialog(-1); return FALSE; } // enable/disable help button automatically CWnd* pHelpButton = GetDlgItem(ID_HELP); if (pHelpButton != NULL) pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE); return TRUE; // set focus to first one }
bool CCpDesktop::FirstInstance() { // Determine if another window with our class name or caption exists... CString strCaption; strCaption.LoadString(GetTitleId()); CWnd* pWndApp = CWnd::FindWindow(NULL, strCaption); if (!pWndApp) return true; // An instance of the app exists // Does it have any popups? CWnd* pPopupWnd = pWndApp->GetLastActivePopup(); // Bring the main window to the top pWndApp->BringWindowToTop(); pWndApp->SetForegroundWindow(); // If iconic, restore the main window if (pWndApp->IsIconic()) pWndApp->ShowWindow(SW_RESTORE); // If there was an active popup, bring it along too if (pPopupWnd && (pPopupWnd != pWndApp)) { pPopupWnd->BringWindowToTop(); pPopupWnd->SetForegroundWindow(); } return false; }
/** * This function 'subclasses' an existing control with the toolbar. This is * not proper subclassing, as we hide the subclassed control, but borrow its * position. * * @param id The id of the control to subclass. */ void DialogToolbar::Subclass(UINT id) { CWnd *parent = GetParent(); CWnd *toolbarHolder = parent->GetDlgItem(id); CSize sizeBar = CalcFixedLayout(FALSE, TRUE); WINDOWPLACEMENT wpl; toolbarHolder->GetWindowPlacement(&wpl); wpl.rcNormalPosition.bottom = wpl.rcNormalPosition.top + sizeBar.cy + 4; wpl.rcNormalPosition.right = wpl.rcNormalPosition.left + sizeBar.cx + 4; toolbarHolder->SetWindowPlacement(&wpl); SetWindowPlacement(&wpl); RepositionBars ( AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0 ); toolbarHolder->ShowWindow(SW_HIDE); SetWindowPos ( &CWnd::wndTop, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOMOVE ); INIT_AUTO_TOOLTIP(); }
void COptionSheet::BuildList() { ASSERT(NULL != m_ListWindow); CWnd *wnd; int i; // Get the list control window wnd = GetListControlWnd(); // Create the list control m_ListWindow->Create(this, IDC_PAGELIST); // Set the controls font wnd->SetFont(&m_Font); // Add the groups for(i = 0; i < GetPageCount(); i++) { if(TRUE == IsPageAGroup(i)) { m_ListWindow->AddGroup(GetPage(i)); } } // Add the pages for(i = 0; i < GetPageCount(); i++) { if(FALSE == IsPageAGroup(i)) { m_ListWindow->AddPage(GetPage(i), GetPageGroup(i)); } } wnd->ShowWindow(SW_SHOW); }
BOOL CNoModemDialog::OnInitDialog() { CBaseDialog::OnInitDialog(); CMlsPropertyControl::SubclassPropertyControls(this); // If there is no help number, get rid of the reference. CWnd* pHelp = GetDlgItem(IDC_HELP_INFO); if (pHelp != NULL) { CInternationalData* pInternationalData = GetApp()->GetInternationalData(); if (pInternationalData != NULL) { if (!pInternationalData->m_InstantSales.m_Help.Exists()) { pHelp->ShowWindow(SW_HIDE); } } } CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CALLBACK EnumWindowsProc(HWND hwnd/*当前找到的窗口句柄*/, LPARAM lParam/*自定义参数*/) //枚举当前窗口 { TCHAR tcClass[256]; LPWSTR pStr = (LPWSTR)lParam; HWND htmpWnd = NULL; ::GetClassName(hwnd, tcClass, 255); DWORD dwProcessID; TCHAR szProcessName[260] = { 0 }; GetWindowThreadProcessId(hwnd, &dwProcessID); HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessID); GetModuleFileNameEx(hProcess, NULL, szProcessName, MAX_PATH); if (strstr(szProcessName, _T("\\PaperEditor.exe")) != NULL) { CWnd * pWndPrev = CWnd::FromHandle(hwnd); pWndPrev = pWndPrev->GetParent(); if (pWndPrev != NULL) { CWnd * pWndChild = pWndPrev->GetLastActivePopup(); if (pWndPrev->IsIconic()) pWndPrev->ShowWindow(SW_RESTORE); pWndChild->SetForegroundWindow(); } } return TRUE; }
void CAddressMessageDlg::OnStaticHazard() { // TODO: Add your control notification handler code here CWnd *pCBox; pCBox = (CComboBox *)GetDlgItem(IDC_STATIC_INITIALIZATION_CODE); pCBox->ShowWindow(SW_SHOW); pCBox = (CComboBox *)GetDlgItem(IDC_INITIALIZATION_CODE); pCBox->ShowWindow(SW_SHOW); pCBox = (CComboBox *)GetDlgItem(IDC_STATIC_TEMPORARY_KEY); pCBox->ShowWindow(SW_SHOW); pCBox = (CComboBox *)GetDlgItem(IDC_TEMPORARY_KEY); pCBox->ShowWindow(SW_SHOW); return; }
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM) { // Killing the timer, because timer can change the // selection in between the procedure... KillTimer( DS_TIMER_ID ); // Yogesh Jagota // sent when a button gets clicked CSwitcherButton* newsel = (CSwitcherButton*)wParam; // Yogesh Jagota CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd(); //CWnd* Window = (CWnd*)newsel->m_FrameWnd;//Y.Ivanov CWnd* Window = (CWnd*)newsel->m_AttachedView->GetParentFrame();//Yuriy Ivanov pFrame->MDIActivate( Window ); if(Window->IsIconic()) Window->ShowWindow(SW_SHOWNORMAL); pFrame->Invalidate(); // End Yogesh Jagota if (m_iSelectedButton > -1) GetButtonFromID(m_iSelectedButton)->Unselect(); m_iSelectedButton = newsel->m_iID; // Reactivate the timer... SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota return 1; }