void COleControl::DestroyTracker() { ASSERT(!m_bOpen); ASSERT(m_bUIActive); if (m_pRectTracker == NULL) return; UINT nHandleSize = m_pRectTracker->m_nHandleSize - 1; // Destroy the tracker. delete m_pRectTracker; m_pRectTracker = NULL; // Restore window to its original (pre-UIActive) size. CWnd* pWndOuter = GetOuterWindow(); CWnd* pWndParent = pWndOuter->GetParent(); CRect rectWindow; CRect rectParent; pWndOuter->GetWindowRect(rectWindow); pWndParent->GetClientRect(rectParent); pWndParent->ClientToScreen(rectParent); rectWindow.OffsetRect(-rectParent.left, -rectParent.top); rectWindow.InflateRect(-(int)nHandleSize, -(int)nHandleSize); ::MoveWindow(pWndOuter->m_hWnd, rectWindow.left, rectWindow.top, rectWindow.Width(), rectWindow.Height(), TRUE); }
BOOL CGetURL::OnInitDialog() { CDialog::OnInitDialog(); IUnknown *pUnk; CWnd *pWnd = GetDlgItem(IDC_EXPLORER); pUnk = NULL; if(pWnd) m_spBrowser = pWnd->GetControlUnknown(); pWnd = NULL; CRect rcItem; pWnd = GetDlgItem(IDC_PHSTATIC); if(pWnd) { pWnd->GetClientRect(rcItem); pWnd->ClientToScreen(rcItem); pWnd->DestroyWindow(); ScreenToClient(rcItem); rcItem.bottom += 150; if(m_AddrCombo.Create(WS_VSCROLL|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_AUTOHSCROLL,rcItem,this,IDC_ADDRCOMBO)) { m_AddrCombo.SetCurSel(0); m_AddrCombo.GetWindowText(m_szCurAddr); if(m_spBrowser && m_szCurAddr.GetLength()) m_spBrowser->Navigate(m_szCurAddr.AllocSysString(),NULL,NULL,NULL,NULL); } } return TRUE; }
////////////////// // Handle button-up: drop the data and return to home state (NONE). // BOOL CDragDropMgr::OnButtonUp(const MSG& msg) { if (!IsDragging()) { SetState(NONE); return FALSE; } if (IsTargetWnd(m_ddi.hwndTarget)) { CPoint pt = GETPOINT(msg.lParam); CWnd* pWndSource = CWnd::FromHandle(m_ddi.hwndSource); CWnd* pWndTarget = CWnd::FromHandle(m_ddi.hwndTarget); pWndSource->ClientToScreen(&pt); pWndTarget->ScreenToClient(&pt); m_ddi.pt = pt; SendDragMessage(WM_DD_DRAGDROP); } else { SendDragMessage(WM_DD_DRAGABORT); } SetState(NONE); return TRUE; }
void CDocumentPreview::SizePreviewWindow(int nWidth, int nHeight) { m_crPreview.left = (m_crFullPreview.left+m_crFullPreview.right-nWidth)/2; m_crPreview.top = (m_crFullPreview.top+m_crFullPreview.bottom-nHeight)/2; m_crPreview.right = m_crPreview.left + nWidth; m_crPreview.bottom = m_crPreview.top + nHeight; CRect r = m_crPreview; // We can't both set and show the window at the same time // with SetWindowPos. So, we call it twice as needed. CWnd* pPreviewWnd = GetPreviewWnd(); pPreviewWnd->SetWindowPos(NULL, r.left-1, r.top-1, nWidth+2, nHeight+2, SWP_NOZORDER | SWP_NOREDRAW); pPreviewWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_SHOWWINDOW); // Invalidate ourselves to avoid background draw. CWnd* pDialog = GetDialog(); pDialog->ClientToScreen(&m_crPreview); pPreviewWnd->ScreenToClient(&m_crPreview); r = m_crPreview; r.left--; r.top--; r.right++; r.bottom++; pPreviewWnd->InvalidateRect(&r, FALSE); }
void CSplitterControl::OnMouseMove(UINT nFlags, CPoint point) { if (m_bMouseIsDown) { // erase the old splitter CWindowDC dc(NULL); this->DrawSplitterLine(&dc); // calc the new pos of the splitter CPoint pt = point; this->ClientToScreen(&pt); CWnd* pParent = GetParent(); ASSERT(pParent); ASSERT(IsWindow(pParent->m_hWnd)); pParent->ScreenToClient(&pt); // split position limit pt.x = (pt.x < m_iMinPos)?m_iMinPos:pt.x; pt.y = (pt.y < m_iMinPos)?m_iMinPos:pt.y; pt.x = (pt.x > m_iMaxPos)?m_iMaxPos:pt.x; pt.y = (pt.y > m_iMaxPos)?m_iMaxPos:pt.y; // save the current pos, this value will be used when the mouse up pParent->ClientToScreen(&pt); m_ptCurrent = pt; // repaint the splitter this->DrawSplitterLine(&dc); } CStatic::OnMouseMove(nFlags, point); }
void CMainFrame::OnViewDropDown(NMTOOLBAR* pnmtb, LRESULT *plr) { // MessageBox("hello"); CWnd *pWnd; UINT nID; // Switch on button command id's. switch (pnmtb->iItem) { case ID_VIEW_VIEW: pWnd = &m_wndToolBar; nID = IDR_VIEW_DROP_DOWN; break; default: return; } // load and display popup menu CMenu menu; menu.LoadMenu(nID); CMenu* pPopup = menu.GetSubMenu(0); ASSERT(pPopup); CRect rc; pWnd->SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc); pWnd->ClientToScreen(&rc); pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, rc.left, rc.bottom, this, &rc); }
void CInteractionAreaDialog::CreateSlidePopup(int nAction, int nButtonId, int nEditId) { CRect rcButton; CWnd *pWndButton = GetDlgItem(nButtonId); pWndButton->GetClientRect(rcButton); pWndButton->ClientToScreen(&rcButton); m_wndMenu.CreatePopupMenu(); CArray<CPage *, CPage *> caPages; m_pEditorDoc->project.GetPages(caPages, 0, m_pEditorDoc->m_docLengthMs); for (int i = 0; i < caPages.GetSize(); ++i) { CString csPageTitle; csPageTitle = caPages[i]->GetTitle(); m_wndMenu.AppendMenu(MF_STRING, i+1, csPageTitle); } BOOL bRet = m_wndMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, rcButton.left, rcButton.bottom, this); CWnd *pEdit = GetDlgItem(nEditId); // if bRet is zero the menu was cancelled // or an error occured if (bRet != 0) { CString csItem; m_wndMenu.GetMenuString(bRet, csItem, MF_BYCOMMAND); pEdit->SetWindowText(csItem); m_nMarkOrPageId[nAction] = caPages[bRet-1]->GetJumpId(); } caPages.RemoveAll(); m_wndMenu.DestroyMenu(); }
BOOL CDlgPointThre::OnInitDialog() { // 调用默认OnInitDialog函数 CDialog::OnInitDialog(); // 获取绘制直方图的标签 CWnd* pWnd = GetDlgItem(IDC_COORD); // 计算接受鼠标事件的有效区域 pWnd->GetClientRect(m_MouseRect); pWnd->ClientToScreen(&m_MouseRect); CRect rect; GetClientRect(rect); ClientToScreen(&rect); m_MouseRect.top -= rect.top; m_MouseRect.left -= rect.left; // 设置接受鼠标事件的有效区域 m_MouseRect.top += 25; m_MouseRect.left += 10; m_MouseRect.bottom = m_MouseRect.top + 255; m_MouseRect.right = m_MouseRect.left + 256; // 初始化拖动状态 m_bIsDraging = FALSE; // 返回TRUE return TRUE; }
void CXTPPropertyGridInplaceMultilineEdit::Create(CXTPPropertyGridItem* pItem, CRect rect) { ASSERT(pItem && pItem->GetGrid()); if (!pItem) return; CRect rcValue(rect); rcValue.left = pItem->GetGrid()->GetDividerPos() + 1; CWnd* pParent = (CWnd*)pItem->GetGrid(); m_pItem = pItem; if (!m_hWnd) { CEdit::CreateEx(WS_EX_TOOLWINDOW, _T("EDIT"), m_pItem->GetValue(), ES_MULTILINE | WS_CHILD | WS_BORDER | WS_VSCROLL | ES_AUTOVSCROLL, CRect(0, 0, 0, 0), pParent, 0); SetOwner(pParent); } SetFont(pParent->GetFont()); int dx = rect.right - rcValue.left; CWindowDC dc(pParent); CXTPFontDC font(&dc, pParent->GetFont()); int nHeight = dc.GetTextExtent(_T(" "), 1).cy; rect.top = rect.bottom; rect.bottom += nHeight * pItem->GetDropDownItemCount() + 4; rect.left = rect.right - __min(dx, rect.Width() - XTP_PGI_EXPAND_BORDER); pParent->ClientToScreen(&rect); CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect); if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y) { rect.OffsetRect(0, - rect.Height() - rcValue.Height() - 1); } if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0); if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0); SetFocus(); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0); ModifyStyle(WS_CHILD, WS_POPUP); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pParent->m_hWnd); SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); CXTPMouseMonitor::SetupHook(this); }
void CDeviceListDlg::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CWnd* pWnd = GetOwner(); char szTmp[MAX_PATH] = {0}; if (FALSE == m_bDragging || NULL == pWnd || 0 == m_hItemDrag) { CDialog::OnLButtonUp(nFlags, point); return; } m_bDragging = FALSE; CImageList::DragLeave( pWnd ); CImageList::EndDrag(); ReleaseCapture(); SAFE_DELETE(m_pDragImage); CIVS_VDemoDlg* pTestDlg = reinterpret_cast<CIVS_VDemoDlg*>(pWnd); CRect rc = pTestDlg->GetTaskDlg()->GetTaskListRect(); pWnd->ClientToScreen(&point); sprintf(szTmp, "OnLButtonUp 2 (%d,%d) ",point.x, point.y); OutputDebugString(szTmp); sprintf(szTmp, "OnLButtonUp 3 (%d,%d)(%d,%d) ",rc.left, rc.top, rc.right, rc.bottom); OutputDebugString(szTmp); if (PtInRect(&rc,point)) { DWORD dwRet = m_TreeDevices.GetItemData(m_hItemDrag); if (dwRet>1024) { int nChildCount = 0; HTREEITEM hItem = m_TreeDevices.GetChildItem(m_hItemDrag); while(hItem) { nChildCount++; hItem = m_TreeDevices.GetNextSiblingItem(hItem); } CFG_TAST_SOURCES* pSource = reinterpret_cast<CFG_TAST_SOURCES*>(dwRet-1024); pTestDlg->GetTaskDlg()->SetOneDeviceInfo(pSource, -1, nChildCount); } else { HTREEITEM hParent = m_TreeDevices.GetParentItem(m_hItemDrag); DWORD dwParent = m_TreeDevices.GetItemData(hParent); CFG_TAST_SOURCES* pSource = reinterpret_cast<CFG_TAST_SOURCES*>(dwParent-1024); pTestDlg->GetTaskDlg()->SetOneDeviceInfo(pSource, dwRet-1); } } CDialog::OnLButtonUp(nFlags, point); }
void COleIPFrameWnd::RecalcLayout(BOOL /*bNotify*/) { ASSERT_VALID(this); // better have a parent window (only used for inplace) CWnd* pParentWnd = GetParent(); ASSERT_VALID(pParentWnd); // first call reposition bars with arbitarily large rect just to // see how much space the bars will take up CRect rectBig(0, 0, INT_MAX/2, INT_MAX/2); CRect rectLeft; RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &rectLeft, &rectBig); // grow the rect by the size of the control bars CRect rect = m_rectPos; rect.left -= rectLeft.left; rect.top -= rectLeft.top; rect.right += INT_MAX/2 - rectLeft.right; rect.bottom += INT_MAX/2 - rectLeft.bottom; // see how much extra space for non-client areas (such as scrollbars) // that the view needs. CWnd* pLeftOver = GetDlgItem(AFX_IDW_PANE_FIRST); if (pLeftOver != NULL) { rectBig = m_rectPos; pLeftOver->CalcWindowRect(&rectBig, CWnd::adjustOutside); rect.left -= m_rectPos.left - rectBig.left; rect.top -= m_rectPos.top - rectBig.top; rect.right += rectBig.right - m_rectPos.right; rect.bottom += rectBig.bottom - m_rectPos.bottom; } // adjust for non-client area on the frame window CalcWindowRect(&rect, CWnd::adjustOutside); // the frame window must be clipped to the visible part in the container CRect rectVis; rectVis.IntersectRect(&rect, &m_rectClip); // move the window AfxRepositionWindow(NULL, m_hWnd, &rectVis); // now resize the control bars relative to the (now moved) frame pParentWnd->ClientToScreen(&rect); ScreenToClient(&rect); RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, CWnd::reposDefault, NULL, &rect); }
void CDocumentPreview::ErasePreview(void) { CRect r = m_crPreview; r.InflateRect(1, 1); CWnd* pPreviewWnd = GetPreviewWnd(); CWnd* pDialog = GetDialog(); if (pPreviewWnd != NULL && pDialog != NULL) { pPreviewWnd->ClientToScreen(&r); pDialog->ScreenToClient(&r); pDialog->InvalidateRect(&r); } }
BOOL CLightWizard::OnInitDialog() { CDialog::OnInitDialog(); if (!LoadList()) { CDialog::OnCancel(); return FALSE; } for ( int i = 0; i < m_aLights.GetSize(); i++ ) { CLightObj * pLight = (CLightObj *) m_aLights.GetAt(i); m_LightList.InsertString(i,pLight->m_csName); m_LightList.SetItemData(i, (DWORD_PTR)pLight); } m_Light1.SetArtType(8); m_Light2.SetArtType(8); m_Light3.SetArtType(8); wFlags = F_BG_GRASS; m_Light1.SetDrawFlags(wFlags); m_Light2.SetDrawFlags(wFlags); m_Light3.SetDrawFlags(wFlags); m_cscLightLevel.SetRange(0, 30); m_cscLightLevel.SetPos(21); CString csValue; csValue.Format("%02ld", m_cscLightLevel.GetPos()); m_csLightValue.SetWindowText(csValue); m_csbScrollLight.EnableWindow(false); m_LightList.SetCurSel(0); OnLightChange(); CRect rectFrame, rectDlg; CWnd* pMainWnd = AfxGetMainWnd(); if(pMainWnd != NULL) { pMainWnd->GetClientRect(rectFrame); pMainWnd->ClientToScreen(rectFrame); GetWindowRect(rectDlg); int nXPos = rectFrame.left + (rectFrame.Width() / 2) - (rectDlg.Width() / 2); int nYPos = rectFrame.top + (rectFrame.Height() / 2) - (rectDlg.Height() / 2); ::SetWindowPos(m_hWnd, HWND_TOP, nXPos, nYPos, rectDlg.Width(), rectDlg.Height(), SWP_NOCOPYBITS); } return TRUE; }
BOOL CWorldMap::OnInitDialog() { CDialog::OnInitDialog(); CRect rectFrame, rectDlg; CWnd* pMainWnd = AfxGetMainWnd(); if(pMainWnd != NULL) { pMainWnd->GetClientRect(rectFrame); pMainWnd->ClientToScreen(rectFrame); GetWindowRect(rectDlg); int nXPos = rectFrame.left + (rectFrame.Width() / 2) - (rectDlg.Width() / 2); int nYPos = rectFrame.top + (rectFrame.Height() / 2) - (rectDlg.Height() / 2); ::SetWindowPos(m_hWnd, HWND_TOP, nXPos, nYPos, rectDlg.Width(), rectDlg.Height(), SWP_NOCOPYBITS); } return TRUE; }
void COleControl::CreateTracker(BOOL bHandles, BOOL bHatching) { ASSERT(bHandles || bHatching); ASSERT(!m_bOpen); ASSERT(m_bUIActive); ASSERT(m_pRectTracker == NULL); UINT nStyle = 0; if (bHandles) nStyle |= CRectTracker::resizeOutside; if (bHatching) nStyle |= CRectTracker::hatchedBorder; ASSERT(nStyle != 0); TRY { // Create the tracker. CRect rectTmp = m_rcPos; _OffsetTrackerRect(rectTmp, this); m_pRectTracker = new CRectTracker(rectTmp, nStyle); UINT nHandleSize = m_pRectTracker->m_nHandleSize++; // Enlarge window to expose non-client area. CWnd* pWndOuter = GetOuterWindow(); CWnd* pWndParent = pWndOuter->GetParent(); CRect rectWindow; CRect rectParent; pWndOuter->GetWindowRect(rectWindow); pWndParent->GetClientRect(rectParent); pWndParent->ClientToScreen(rectParent); rectWindow.OffsetRect(-rectParent.left, -rectParent.top); rectWindow.InflateRect(nHandleSize, nHandleSize); ::MoveWindow(pWndOuter->m_hWnd, rectWindow.left, rectWindow.top, rectWindow.Width(), rectWindow.Height(), TRUE); } CATCH (CException, e) { // If anything went wrong, just continue without the tracker. if (m_pRectTracker != NULL) { delete m_pRectTracker; m_pRectTracker = NULL; } } END_CATCH }
void COleResizeBar::OnLButtonDown(UINT /*nFlags*/, CPoint point) { // track to parent of the parent CWnd* pFrameWnd = GetParentFrame(); ASSERT_VALID(pFrameWnd); CWnd* pParent = pFrameWnd->GetParent(); pFrameWnd->UpdateWindow(); // update ourselves // limit tracking to parent client rectangle if (pParent != NULL) { pParent->UpdateWindow(); // always update before tracking // clip cursor to parent window CRect rect; pParent->GetClientRect(&rect); pParent->ClientToScreen(&rect); ::ClipCursor(&rect); } // save the rect, track, then restore CRect rectSave = m_tracker.m_rect; BOOL bNotify = m_tracker.Track(this, point, FALSE, pParent); CRect rectNew = m_tracker.m_rect; m_tracker.m_rect = rectSave; // allow full mouse movement again ::ClipCursor(NULL); // notify owner window if tracker changed if (bNotify) { CWnd* pOwner = GetOwner(); ASSERT_VALID(pOwner); // convert relative to parent coordinates ClientToScreen(&rectNew); pOwner->ScreenToClient(&rectNew); // send notification to owner pOwner->SendMessage(WM_SIZECHILD, (WPARAM)_AfxGetDlgCtrlID(m_hWnd), (LPARAM)(LPCRECT)&rectNew); } }
void CScrollerCorner::OnLButtonDown(wxMouseEvent &event) { #ifdef GERRYXXX CWnd::OnLButtonDown(nFlags, pt); CWnd* pParent = GetParent(); CRect rWin; pParent->GetWindowRect(&rWin); // calc screen coords of bottom-right frame corner pt.x = rWin.Width() - 1; pt.y = rWin.Height() - 1; pParent->ClientToScreen(&pt); pParent->SendMessage(WM_NCLBUTTONDOWN, WPARAM(HTSIZE), MAKELPARAM(WORD(pt.x), WORD(pt.y))); #endif }
BOOL CDlgCreateSpecularTexture::PreTranslateMessage(MSG* pMsg) { ULONG fwKeys = pMsg->wParam; PIX xPos = LOWORD(pMsg->lParam); PIX yPos = HIWORD(pMsg->lParam); CPoint point = CPoint(xPos, yPos); CPoint pointScreen; GetCursorPos( &pointScreen); CWnd *pWndPreview = GetDlgItem(IDC_PREVIEW_FRAME); CRect rectPreview; pWndPreview->GetClientRect( &rectPreview); pWndPreview->ClientToScreen( &rectPreview); if( rectPreview.PtInRect( pointScreen)) { if( (pMsg->message == WM_MOUSEMOVE) && (bWeStartedMouseDown) ) { if( fwKeys&MK_LBUTTON) a3dObjectRotation = GetRotForDelta( point-ptLMBDown, FALSE); else if( fwKeys&MK_RBUTTON) a3dLightRotation = GetRotForDelta( point-ptRMBDown, FALSE); } else if( (pMsg->message == WM_LBUTTONDOWN) || ( pMsg->message == WM_RBUTTONDOWN) ) { ptLMBDown = point; ptRMBDown = point; bWeStartedMouseDown = TRUE; } else if( (pMsg->message == WM_LBUTTONUP) && (bWeStartedMouseDown) ) { a3dObjectRotation = GetRotForDelta( point-ptLMBDown, FALSE); bWeStartedMouseDown = FALSE; } else if( (pMsg->message == WM_RBUTTONUP) && (bWeStartedMouseDown) ) { a3dLightRotation = GetRotForDelta( point-ptRMBDown, FALSE); bWeStartedMouseDown = FALSE; } } return CDialog::PreTranslateMessage(pMsg); }
void URLLabel::OnMouseLeave() { reg_mouseleave = false; mouse_hover = false; // repaint our window CWnd *parent = GetParent(); if (parent) { CPoint pt(0, 0); parent->ClientToScreen(&pt); CPoint op(0, 0); ClientToScreen(&op); CRect rc; GetClientRect(&rc); rc.OffsetRect(op.x - pt.x, op.y - pt.y); parent->InvalidateRect(&rc); Invalidate(); } }
void ArxDbgUiDlgColor::calculateRectSize(UINT controlId, CRect& rect, double gridX, double gridY, long& sizeX, long& sizeY, long& bookEndGapX, long& bookEndGapY) { CWnd* tmpWnd = GetDlgItem(controlId); ASSERT(tmpWnd != NULL); tmpWnd->GetClientRect(rect); tmpWnd->ClientToScreen(rect); ScreenToClient(rect); rect.DeflateRect(1, 1); // get the size of each tile double rectWidth = static_cast<double>(rect.Width()); sizeX = static_cast<long>(rectWidth / gridX); double rectHeight = static_cast<double>(rect.Height()); sizeY = static_cast<long>(rectHeight / gridY); bookEndGapX = static_cast<long>((rectWidth - (gridX * sizeX)) / 2.0); bookEndGapY = static_cast<long>((rectHeight - (gridY * sizeY)) / 2.0); }
void CExtButton::_CbPaintCombinedContent( LPVOID pCookie, CDC & dc, const CWnd & refWndMenu, const CRect & rcExcludeArea, // in screen coords int eCombineAlign // CExtPopupMenuWnd::e_combine_align_t values ) { pCookie; dc; refWndMenu; rcExcludeArea; eCombineAlign; ASSERT( dc.GetSafeHdc() != NULL ); ASSERT( refWndMenu.GetSafeHwnd() != NULL ); CExtButton * pBtn = (CExtButton *)pCookie; ASSERT( pBtn != NULL ); ASSERT_VALID( pBtn ); ASSERT( pBtn->IsKindOf(RUNTIME_CLASS(CExtButton)) ); ASSERT( eCombineAlign != CExtPopupMenuWnd::__CMBA_NONE ); if( rcExcludeArea.IsRectEmpty() ) return; CRect rcClientBar,rcClientExcludeArea; pBtn->GetClientRect( &rcClientBar ); pBtn->ClientToScreen( &rcClientBar ); refWndMenu.GetClientRect( &rcClientExcludeArea ); refWndMenu.ClientToScreen( &rcClientExcludeArea ); CPoint ptOffset = rcClientBar.TopLeft() - rcClientExcludeArea.TopLeft() ; CPoint ptViewportOrg = dc.GetViewportOrg(); dc.SetViewportOrg( ptOffset ); pBtn->_RenderImpl(dc,true); dc.SetViewportOrg( ptViewportOrg ); }
// handle mouse enter/leave void URLLabel::OnMouseMove(UINT nFlags, CPoint point) { if (!reg_mouseleave) { reg_mouseleave = true; // we want to receive the WM_MOUSELEAVE notification TRACKMOUSEEVENT tm; tm.cbSize = sizeof(tm); tm.dwFlags = TME_LEAVE; tm.dwHoverTime = 0; tm.hwndTrack = *this; TrackMouseEvent(&tm); } if (!mouse_hover) { mouse_hover = true; // repaint our window CWnd *parent = GetParent(); if (parent) { CPoint pt(0, 0); parent->ClientToScreen(&pt); CPoint op(0, 0); ClientToScreen(&op); CRect rc; GetClientRect(&rc); rc.OffsetRect(op.x - pt.x, op.y - pt.y); parent->InvalidateRect(&rc); Invalidate(); } } }
//******************************************************************************************* BOOL CBCGPFrameWnd::PreTranslateMessage(MSG* pMsg) { BOOL bProcessAccel = TRUE; switch (pMsg->message) { case WM_SYSKEYDOWN: #ifndef BCGP_EXCLUDE_RIBBON if (m_Impl.m_pRibbonBar != NULL && m_Impl.m_pRibbonBar->OnSysKeyDown (this, pMsg->wParam, pMsg->lParam)) { return TRUE; } if (pMsg->wParam == VK_F4 && m_Impl.m_pRibbonBar != NULL && m_Impl.m_pRibbonBar->IsBackstageViewActive()) { break; } #endif if (CBCGPPopupMenu::GetSafeActivePopupMenu() == NULL) { m_Impl.CancelToolbarMode(); } case WM_CONTEXTMENU: if (!globalData.m_bSysUnderlineKeyboardShortcuts && !globalData.m_bUnderlineKeyboardShortcuts) { globalData.m_bUnderlineKeyboardShortcuts = TRUE; CBCGPToolBar::RedrawUnderlines (); } if (CBCGPPopupMenu::GetSafeActivePopupMenu() != NULL && (pMsg->wParam == VK_MENU || pMsg->wParam == VK_F10)) { CBCGPPopupMenu::m_pActivePopupMenu->SendMessage (WM_CLOSE); return TRUE; } else if (m_Impl.ProcessKeyboard ((int) pMsg->wParam)) { return TRUE; } break; case WM_SYSKEYUP: if (m_Impl.ProcessSysKeyUp(pMsg->wParam, pMsg->lParam)) { return TRUE; } break; case WM_KEYDOWN: //----------------------------------------- // Pass keyboard action to the active menu: //----------------------------------------- if (!CBCGPFrameImpl::IsHelpKey (pMsg) && m_Impl.ProcessKeyboard ((int) pMsg->wParam, &bProcessAccel)) { return TRUE; } if (pMsg->wParam == VK_ESCAPE) { if (IsFullScreen()) { if (!IsPrintPreview()) { m_Impl.InvokeFullScreenCommand(); return TRUE; } } CBCGPSmartDockingManager* pSDManager = NULL; if ((pSDManager = m_dockManager.GetSDManagerPermanent()) != NULL && pSDManager->IsStarted()) { pSDManager->CauseCancelMode (); } CBCGPSlider* pSlider = DYNAMIC_DOWNCAST (CBCGPSlider, GetCapture ()); if (pSlider != NULL) { pSlider->SendMessage (WM_CANCELMODE); return TRUE; } } if (!bProcessAccel) { return FALSE; } break; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MBUTTONDOWN: case WM_MBUTTONUP: { CPoint pt (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)); CWnd* pWnd = CWnd::FromHandle (pMsg->hwnd); if (pWnd != NULL && ::IsWindow (pMsg->hwnd)) { pWnd->ClientToScreen (&pt); } if (m_Impl.ProcessMouseClick (pMsg->message, pt, pMsg->hwnd)) { return TRUE; } if (!::IsWindow (pMsg->hwnd)) { return TRUE; } } break; case WM_NCLBUTTONDOWN: case WM_NCLBUTTONUP: case WM_NCRBUTTONDOWN: case WM_NCRBUTTONUP: case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: if (m_Impl.ProcessMouseClick (pMsg->message, CPoint (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)), pMsg->hwnd)) { return TRUE; } break; case WM_MOUSEWHEEL: if (m_Impl.ProcessMouseWheel (pMsg->wParam, pMsg->lParam)) { return TRUE; } break; case WM_MOUSEMOVE: { CPoint pt (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)); CWnd* pWnd = CWnd::FromHandle (pMsg->hwnd); if (pWnd != NULL) { pWnd->ClientToScreen (&pt); } if (m_Impl.ProcessMouseMove (pt)) { return TRUE; } } } return CFrameWnd::PreTranslateMessage(pMsg); }
BOOL CChildFrame::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class CMainFrame * pMainFrame = AfxGetMainFrame( ); if( WM_SYSKEYDOWN == pMsg->message || WM_SYSKEYUP == pMsg->message || WM_SYSCHAR == pMsg->message ) { if( pMainFrame && VK_F4 == pMsg->wParam ) { pMainFrame->PostMessage( WM_CLOSE ); return TRUE; } } else if( WM_RBUTTONUP == pMsg->message || WM_RBUTTONDOWN == pMsg->message || WM_NCRBUTTONUP == pMsg->message || WM_NCRBUTTONDOWN == pMsg->message ) { CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); CView * pView = DYNAMIC_DOWNCAST( CView, pWnd ); if( NULL == pView ) pView = GetActiveView(); UINT nMenuID = 0; if( pView && pView->IsKindOf(RUNTIME_CLASS(CWizardView)) ) nMenuID = IDR_POPUP_WIZARDVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSimuView)) ) nMenuID = IDR_POPUP_SIMUVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)) ) nMenuID = IDR_POPUP_SLISTVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView)) ) { pView->PostMessage(WM_USER_MYRBUTTONDOWN,pMsg->wParam,pMsg->lParam); nMenuID = IDR_POPUP_GRAPHVIEW; } else if( pView && pView->IsKindOf(RUNTIME_CLASS(CRealTimeView)) ) nMenuID = IDR_POPUP_REALTIMEVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CMultiSortView)) ) nMenuID = IDR_POPUP_MULTISORTVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CBaseView)) ) nMenuID = IDR_POPUP_BASEVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)) ) nMenuID = IDR_POPUP_SETTING; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CStrategyView)) ) nMenuID = IDR_POPUP_SIMUVIEW; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CGroupView)) ) nMenuID = IDR_POPUP_SETTING; else if( pView && pView->IsKindOf(RUNTIME_CLASS(CTechsView)) ) nMenuID = IDR_POPUP_SETTING; if( pMainFrame && 0 != nMenuID ) { if( pWnd && WM_RBUTTONUP == pMsg->message ) { CPoint pt; pt.x = LOWORD(pMsg->lParam); pt.y = HIWORD(pMsg->lParam); pWnd->ClientToScreen(&pt); CMenu menu; if( menu.LoadMenu( nMenuID ) ) { CMenu * pMenu = menu.GetSubMenu(0); for( UINT nMenu=0; pMenu && nMenu<pMenu->GetMenuItemCount(); nMenu++ ) { CMenu * pPopupMenu = pMenu->GetSubMenu(nMenu); pMainFrame->InitMenuPopup( pPopupMenu ); } /* ProfUIS Using Code CExtPopupMenuWnd * pPopupWnd = new CExtPopupMenuWnd; VERIFY( pPopupWnd->UpdateFromMenu( pMainFrame->GetSafeHwnd(), &menu, true, true ) ); VERIFY( pPopupWnd->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, pMainFrame->GetSafeHwnd() ) ); */ VERIFY( pMenu->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, pMainFrame ) ); } } return TRUE; } } /* ProfUIS Using Code if( pMainFrame && pMainFrame->m_wndMenuBar.TranslateMainFrameMessage(pMsg) ) return TRUE; */ return CMDIChildWnd::PreTranslateMessage(pMsg); }
BOOL CDlgIntensity::OnInitDialog() { // 指向源图像象素的指针 unsigned char * lpSrc; // 循环变量 LONG i; LONG j; // 调用默认OnInitDialog函数 CDialog::OnInitDialog(); // 获取绘制直方图的标签 CWnd* pWnd = GetDlgItem(IDC_COORD); // 计算接受鼠标事件的有效区域 pWnd->GetClientRect(m_MouseRect); pWnd->ClientToScreen(&m_MouseRect); CRect rect; GetClientRect(rect); ClientToScreen(&rect); m_MouseRect.top -= rect.top; m_MouseRect.left -= rect.left; // 设置接受鼠标事件的有效区域 m_MouseRect.top += 25; m_MouseRect.left += 10; m_MouseRect.bottom = m_MouseRect.top + 255; m_MouseRect.right = m_MouseRect.left + 256; // 重置计数为0 for (i = 0; i < 256; i ++) { // 清零 m_lCount[i] = 0; } // 图像每行的字节数 LONG lLineBytes; // 计算图像每行的字节数 lLineBytes = WIDTHBYTES(m_lWidth * 8); // 计算各个灰度值的计数 for (i = 0; i < m_lHeight; i ++) { for (j = 0; j < m_lWidth; j ++) { lpSrc = (unsigned char *)m_lpDIBBits + lLineBytes * i + j; // 计数加1 m_lCount[*(lpSrc)]++; } } // 初始化拖动状态 m_iIsDraging = 0; // 返回TRUE return TRUE; }
//******************************************************************************************* BOOL CBCGPOleDocIPFrameWnd::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { case WM_KEYDOWN: if (!CBCGPFrameImpl::IsHelpKey (pMsg) && m_Impl.ProcessKeyboard ((int) pMsg->wParam)) { return TRUE; } break; case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_RBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: { CPoint pt (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)); CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd); if (pWnd != NULL && ::IsWindow (pMsg->hwnd)) { pWnd->ClientToScreen (&pt); } if (m_Impl.ProcessMouseClick (pMsg->message, pt, pMsg->hwnd)) { return TRUE; } if (!::IsWindow (pMsg->hwnd)) { return TRUE; } } break; case WM_NCLBUTTONDOWN: case WM_NCLBUTTONUP: case WM_NCRBUTTONDOWN: case WM_NCRBUTTONUP: case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: if (m_Impl.ProcessMouseClick (pMsg->message, CPoint (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)), pMsg->hwnd)) { return TRUE; } break; case WM_MOUSEMOVE: { CPoint pt (BCG_GET_X_LPARAM(pMsg->lParam), BCG_GET_Y_LPARAM(pMsg->lParam)); CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd); if (pWnd != NULL) { pWnd->ClientToScreen (&pt); } if (m_Impl.ProcessMouseMove (pt)) { return TRUE; } } } return CFrameWnd::PreTranslateMessage(pMsg); }
void CXTPPropertyGridInplaceList::Create(CXTPPropertyGridItem* pItem, CRect rect) { ASSERT(pItem && pItem->GetGrid()); if (!pItem) return; CRect rcValue(rect); rcValue.left = pItem->GetGrid()->GetDividerPos() + 1; CWnd* pParent = (CWnd*)pItem->GetGrid(); m_pItem = pItem; DestroyWindow(); if (!m_hWnd) { CListBox::CreateEx(WS_EX_TOOLWINDOW | (pParent->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""), LBS_NOTIFY | WS_CHILD | WS_VSCROLL | WS_BORDER | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS, CRect(0, 0, 0, 0), pParent, 0); SetOwner(pParent); if (m_bShowShadow && XTPSystemVersion()->IsWinXPOrGreater()) SetClassLongPtr(m_hWnd, GCL_STYLE, GetClassLongPtr(m_hWnd, GCL_STYLE) | 0x00020000); } SetFont(pParent->GetFont()); ResetContent(); CXTPPropertyGridItemConstraints* pList = pItem->GetConstraints(); int dx = rect.right - rcValue.left; CWindowDC dc(pParent); CXTPFontDC font(&dc, pParent->GetFont()); int nHeight = dc.GetTextExtent(_T(" "), 1).cy + 3; for (int i = 0; i < pList->GetCount(); i++) { CXTPPropertyGridItemConstraint* pConstraint = pList->GetConstraintAt(i); CString str = pConstraint->m_strConstraint; int nIndex = AddString(str); SetItemDataPtr(nIndex, pConstraint); CSize sz = pItem->OnMergeItemConstraint(&dc, pConstraint); dx = max(dx, sz.cx); nHeight = max(nHeight, sz.cy); if (pItem->GetValue() == str) SetCurSel(nIndex); } SetItemHeight(0, nHeight); rect.top = rect.bottom; rect.bottom += nHeight * __min(pItem->GetDropDownItemCount(), GetCount()) + 2; rect.left = rect.right - __min(dx, rect.Width() - XTP_PGI_EXPAND_BORDER); pParent->ClientToScreen(&rect); CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect); if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y) { rect.OffsetRect(0, - rect.Height() - rcValue.Height() - 1); } if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0); if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0); SetFocus(); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0); ModifyStyle(WS_CHILD, WS_POPUP); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pParent->m_hWnd); SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); CXTPMouseMonitor::SetupHook(this); }
////////////////// // User pressed mouse: intialize and enter drag state // void CSizerBar::OnLButtonDown(UINT nFlags, CPoint pt) { m_bDragging=TRUE; m_ptOriginal = m_ptPrevious = Rectify(pt); GetWindowRect(&m_rcBar); // bar location in screen coords DrawBar(); // draw it SetCapture(); // all mouse messages are MINE m_hwndPrevFocus = ::SetFocus(m_hWnd); // set focus to me to get Escape key ASSERT(m_pWinMgr); CWinMgr& wm = *m_pWinMgr; // get WINRECTs on either side of me WINRECT* pwrcSizeBar = wm.FindRect(GetDlgCtrlID()); ASSERT(pwrcSizeBar); WINRECT* prev = pwrcSizeBar->Prev(); ASSERT(prev); WINRECT* next = pwrcSizeBar->Next(); ASSERT(next); // get rectangles on eithr side of me CRect rcPrev = prev->GetRect(); CRect rcNext = next->GetRect(); // get parent window CWnd * pParentWnd = GetParent(); ASSERT(pParentWnd); // Get size info for next/prev rectangles, so I know what the min/max // sizes are and don't violate them. Max size never tested. SIZEINFO szi; wm.OnGetSizeInfo(szi, prev, pParentWnd); CRect rcPrevMin(rcPrev.TopLeft(),szi.szMin); CRect rcPrevMax(rcPrev.TopLeft(),szi.szMax); wm.OnGetSizeInfo(szi, next, pParentWnd); CRect rcNextMin(rcNext.BottomRight()-szi.szMin, rcNext.BottomRight()); CRect rcNextMax(rcNext.BottomRight()-szi.szMax, rcNext.BottomRight()); // Initialize m_rcConstrain. This is the box the user is allowed to move // the sizer bar in. Can't go outside of this--would violate min/max // constraints of windows on either side. m_rcConstrain.SetRect( max(rcPrevMin.right, rcNextMax.left), max(rcPrevMin.bottom,rcNextMax.top), min(rcPrevMax.right, rcNextMin.left), min(rcPrevMax.bottom,rcNextMin.top)); // convert to my client coords pParentWnd->ClientToScreen(&m_rcConstrain); ScreenToClient(&m_rcConstrain); // Now adjust m_rcConstrain for the fact the bar is not a pure line, but // has solid width -- so I have to make a little bigger/smaller according // to the offset of mouse coords within the sizer bar rect iteself. ClientToScreen(&pt); m_rcConstrain.SetRect(m_rcConstrain.TopLeft() + (pt - m_rcBar.TopLeft()), m_rcConstrain.BottomRight() - (m_rcBar.BottomRight()-pt)); }
//************************************************************************** void CBCGPRibbonComboBox::DropDownList () { ASSERT_VALID (this); if (IsDisabled ()) { return; } if (m_pWndEdit->GetSafeHwnd () != NULL && !m_pWndEdit->IsWindowVisible ()) { return; } if (CBCGPPopupMenu::GetActiveMenu () != NULL) { if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu) { CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE); return; } } CBCGPBaseRibbonElement::OnShowPopupMenu (); if (m_bIsCalculator) { if (m_pCalcPopup != NULL) { m_pCalcPopup->SendMessage (WM_CLOSE); m_pCalcPopup = NULL; SetDroppedDown(NULL); } else { if (CBCGPPopupMenu::GetActiveMenu () != NULL) { if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu) { CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE); return; } } CBCGPBaseRibbonElement::OnShowPopupMenu (); double dblValue = 0.; CString strValue = GetEditText (); if (!strValue.IsEmpty ()) { strValue.Replace (_T(','), _T('.')); #if _MSC_VER < 1400 _stscanf (strValue, _T("%lf"), &dblValue); #else _stscanf_s (strValue, _T("%lf"), &dblValue); #endif } m_pCalcPopup = new CBCGPCalculatorPopup (dblValue, 0, this); m_pCalcPopup->m_bAutoDestroyParent = FALSE; m_pCalcPopup->SetParentRibbonElement (this); CBCGPCalculator* pCalc = DYNAMIC_DOWNCAST (CBCGPCalculator, m_pCalcPopup->GetMenuBar()); if (pCalc != NULL) { ASSERT_VALID (pCalc); if (!m_lstCalcAdditionalCommands.IsEmpty ()) { pCalc->SetAdditionalCommands (m_lstCalcAdditionalCommands); } if (!m_lstCalcExtCommands.IsEmpty ()) { pCalc->SetExtendedCommands (m_lstCalcExtCommands); } if (!m_strCalcDisplayFormat.IsEmpty()) { pCalc->SetDisplayFormat(m_strCalcDisplayFormat); } } CRect rectWindow; m_pWndEdit->GetWindowRect (rectWindow); if (!m_pCalcPopup->Create (m_pWndEdit, rectWindow.left - m_szMargin.cx, rectWindow.bottom + m_szMargin.cy, NULL, TRUE)) { ASSERT (FALSE); m_pCalcPopup = NULL; } else { SetDroppedDown(m_pCalcPopup); m_pCalcPopup->GetMenuBar()->SetFocus (); CRect rect; m_pCalcPopup->GetWindowRect (&rect); m_pCalcPopup->UpdateShadow (&rect); } } return; } CBCGPDropDownList* pList = new CBCGPDropDownList (this); pList->SetParentRibbonElement (this); int i = 0; for (POSITION pos = m_lstItems.GetHeadPosition (); pos != NULL; i++) { CString strItem = m_lstItems.GetNext (pos); pList->AddString (strItem); if (m_bHasEditBox && strItem == m_strEdit) { m_iSelIndex = i; } } pList->SetCurSel (m_iSelIndex); pList->SetMaxHeight (m_nDropDownHeight); pList->SetMinWidth (m_rect.Width ()); CWnd* pWndParent = GetParentWnd (); if (pWndParent == NULL) { ASSERT (FALSE); return; } const BOOL bIsRTL = (pWndParent->GetExStyle () & WS_EX_LAYOUTRTL); CRect rect = m_rectCommand.IsRectEmpty () ? m_rect : m_rectCommand; pWndParent->ClientToScreen (&rect); SetDroppedDown (pList); if (m_pParent != NULL) { ASSERT_VALID (m_pParent); m_pParent->HighlightPanel (NULL, CPoint (-1, -1)); } if (m_pWndEdit->GetSafeHwnd () != NULL) { m_pWndEdit->SetFocus (); m_pWndEdit->SetSel (0, -1); } if (m_bResizeDropDownList) { pList->EnableVertResize (2 * globalData.GetTextHeight ()); } pList->Track (CPoint ( bIsRTL ? rect.right : rect.left, rect.bottom), pWndParent->GetOwner ()); }
BOOL CToleadtitleDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CWnd* pWnd = GetDlgItem( IDC_STATIC_PLACEHOLDER ); CRect rcCtrl; pWnd->GetClientRect( &rcCtrl ); pWnd->ClientToScreen( &rcCtrl ); pWnd->DestroyWindow(); ScreenToClient( &rcCtrl ); DWORD dwStyle = WS_CHILD|WS_BORDER|WS_VSCROLL|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN; m_RichEditCtrl.Create( dwStyle, rcCtrl, this, 0x1245 ); CString dbdata=path+"\\data\\error.db"; int result=sqlite3_open(dbdata,&db); if(result!=SQLITE_OK) { MessageBox("failed to open database!",NULL,MB_OK); OnCancel(); return FALSE; } CEdit* pEdit = (CEdit*)m_type.GetWindow(GW_CHILD); // 将输入框色设置为只读 pEdit->SetReadOnly(TRUE); m_type.SetCurSel(0); //////////////////////////////////////////////////////// //读取输入历史记录 string str; CString historydata=path+"\\data\\history.ini"; fstream fpinput; fpinput.open(historydata,ios::in); int len; getline(fpinput,str); len=atoi(str.data()); for(;len--;) { getline(fpinput,str); m_A.AddString(str.data()); combox_A.push_back(str); } getline(fpinput,str); len=atoi(str.data()); for(;len--;) { getline(fpinput,str); m_B.AddString(str.data()); combox_B.push_back(str); } fpinput.close(); //////////////////////////////////////////////////////// m_A.SetCurSel(0); m_B.SetCurSel(0); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control }