// SprinklerBySectionDlg.cpp : implementation file // #include "stdafx.h" #include "DbEquipment.h" #include "Dbpipe.h" #include "TRegProperty.h" #include "layerdef.h" #include "SprinklerBySectionDlg.h" #include "SprinklerByLineDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern AcDbObjectId InitLayer(const TCHAR *szLayer, AcDbDatabase *pDb = NULL); //************************************************************************** // 扇形喷头 //************************************************************************** void SprinklerBySector() { CString csDwb = g_csDwbPath + _T("TwtSys"); XString xsTmp, xsTmp2, xsTmp3, xsTmp4, xsTmp5; XString xsTmp6, xsTmp7, xsTmp8;//zxl 2011.12.19 add 增加水喷雾喷头 if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000125"), xsTmp) != RTNORM) return; if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000128"), xsTmp2) != RTNORM) return; if (GlobalFunc::LoadDwbBlock(csDwb, _T("00000283"), XString()) != RTNORM) // cet 2011.2.28 add 剖切时需要的图块 { return; } if (GlobalFunc::LoadDwbBlock(csDwb, _T("00000529"), xsTmp6) != RTNORM)//zxl 2011.12.19 add 增加水喷雾喷头 { return; } if (GlobalFunc::LoadDwbBlock(csDwb, _T("00000540"), xsTmp7) != RTNORM) // cet 2013.1.5 add 直立型水幕 { return; } if (GlobalFunc::LoadDwbBlock(csDwb, _T("00000541"), xsTmp8) != RTNORM) // cet 2013.1.5 add 下垂型水幕 { return; } if(g_Option::instance().g_bBlk3D){ if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000365"), xsTmp3) != RTNORM) return; if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000366"), xsTmp4) != RTNORM) return; if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000367"), xsTmp5) != RTNORM) return; } int nOsMode=0; xg_getvar(_T("OSMODE"), &nOsMode); nOsMode &= ~0x4000; nOsMode |= OS_INT|OS_NEA; XPushVar vOsMode(_T("OSMODE"), nOsMode); XPushVar vOrthoMode(_T("ORTHOMODE"), 0); //f8 CSprinklerBySectionDlg dlg(acedGetAcadFrame()); { CTemporaryResourceOverride vTemp; dlg.Create(IDD_SPRINKLER_SECTOR, acedGetAcadFrame()); dlg.ShowWindow(SW_SHOW); acedGetAcadDwgView()->SetFocus(); } CString m_csSysBlk1 = _T("TWTSYS(00000283)"); CString m_csSysBlk2 = _T("TWTSYS(00000530)");//水喷雾 系统 zxl 2011.12.19 add while(1) { XPointList lstPt; XPoint ptStart, ptEnd, ptMid; int nOsMode; xg_getvar(_T("OSMODE"), &nOsMode); nOsMode &= ~0x4000; nOsMode |= OS_INT|OS_NEA|OS_END; XPushVar vOsMode(_T("OSMODE"), nOsMode); if(ads_getpoint(NULL, _T("\n请输入扇形大弧起始点<退出>:"), ptStart) != RTNORM){ break; } if(ads_getpoint(ptStart, _T("\n请输入扇形大弧终点<退出>:"), ptEnd) != RTNORM){ break; } if(ads_getpoint(ptStart, _T("\n点取扇形大弧上一点<退出>:"), ptMid) != RTNORM){ break; } ptStart = GlobalFunc::Ucs2Wcs(ptStart); ptEnd = GlobalFunc::Ucs2Wcs(ptEnd); ptMid = GlobalFunc::Ucs2Wcs(ptMid); TSprinklerJig jig(&dlg, ptStart, ptEnd, ptMid); jig.SetPrompt(_T("\n请输入终点<退出>:")); int nKeyIdx; if(jig.DoIt(&nKeyIdx) != RTNORM){ dlg.DestroyWindow(); return; } // ptEnd = jig.GetPickPoint(); XPushVar vOsMode2(_T("OSMODE"), 0); int len = jig.m_pDrawEnt->m_lstPt.Length(); //zxl 2011.11.29 modify //InitPipeLayer(LAY_PIPE_SPRINKLE); GlobalFunc::InitPipeLayer(dlg.GetPipeLayer()); InitLayer(LAY_EQUIP_SPRINKLE); for(int i=0;im_lstPt[i]; CDbEquipment *pEquip = new CDbEquipment; if(dlg.m_bNoBreak == 2){ pEquip->SetBlock2d(GlobalFunc::GetBlkIdByName(xsTmp2)); pEquip->SetHidePipe(TRUE); pEquip->SetPipeLength(250); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp5)); pEquip->SetSysBlock(m_csSysBlk1); } else if (dlg.m_bNoBreak == 3)//zxl 2011.12.19 add 增加水喷雾喷头 { pEquip->SetBlock2d(GlobalFunc::GetBlkIdByName(xsTmp6)); pEquip->SetHidePipe(TRUE); pEquip->SetPipeLength( -250 ); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp3)); pEquip->SetSysBlock(m_csSysBlk2); } else if (dlg.m_bNoBreak == 4) // cet 2013.1.5 add 增加直立型水幕 { pEquip->SetHidePipe(TRUE); pEquip->SetPipeLength(250); pEquip->SetSysBlock(_T("TWTSYS(00000542)")); pEquip->SetBlock2d(GlobalFunc::GetBlkIdByName(xsTmp7)); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp4)); } else if (dlg.m_bNoBreak == 5) // cet 2013.1.5 add 增加下垂型水幕 { pEquip->SetHidePipe(TRUE); pEquip->SetPipeLength(-250); pEquip->SetSysBlock(_T("TWTSYS(00000542)")); pEquip->SetBlock2d(GlobalFunc::GetBlkIdByName(xsTmp8)); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp3)); } else{ pEquip->SetBlock2d(GlobalFunc::GetBlkIdByName(xsTmp)); if(dlg.m_bNoBreak == 0){ //上喷 pEquip->SetHidePipe(TRUE); pEquip->SetPipeLength(250); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp4)); pEquip->SetSysBlock(m_csSysBlk1); } else if(dlg.m_bNoBreak == 1){ pEquip->SetHidePipe(FALSE); pEquip->SetBlock3d(GlobalFunc::GetBlkIdByName(xsTmp3)); pEquip->SetPipeLength(-250); pEquip->SetSysBlock(m_csSysBlk1); } } pt.z = dlg.m_nEle * 1000; pEquip->SetLocation(pt); pEquip->SetNumber(_T("CIRCLE-1")); pEquip->SetScale(g_Option::instance().g_nSprinklerRadius); //pEquip->SetSysBlock(m_csSysBlk1); pEquip->setLayer(LAY_EQUIP_SPRINKLE); pEquip->setColor(AcCmColor()); //随层 GlobalFunc::AddToCurrentSpace(pEquip, Adesk::kTrue); Entity entLast; entLast.GetLast(); GlobalFunc::WriteXdata(entLast, _T("HYDRANT_RADIUS"), dlg.m_csRadius); } // cet 2011.5.26 add 添加标注 if (dlg.m_bDim) { //int nCol = dlg.m_lstColPt.Length(); //if (nCol > 3) //{ // XArc arc(*dlg.m_lstColPt[1], *dlg.m_lstColPt[2], *dlg.m_lstColPt[nCol - 1]); // XCurveSegment segDim; // segDim = arc; // TDbDimension2 *pDim = new TDbDimension2; // pDim->setLayer(LAY_DIM_SPRINKLE); // pDim->SetStyleId(InitDimStyle(DS_ANGLE)); // pDim->SetDist2DimLine(-6.0); // XPoint ptFix; // ads_polar(segDim.GetStartPoint(), segDim.IDirection(0)-PI/2, 2.0*DocGetPScale(), ptFix); // pDim->SetLocation(ptFix); // pDim->SetRotation(segDim.IDirection(0)); // pDim->SetAngular(TRUE); // pDim->SetDimChord(FALSE); // pDim->SetObjRadius(arc.GetRadius()); // pDim->SetDimRadius(arc.GetRadius() + 8.0*DocGetPScale()); // XArc arDimLine= arc; // arDimLine.SetRadius(arDimLine.GetRadius() + 8.0*DocGetPScale()); // for(int j = 1; j < nCol - 1; j++) // { // XPoint pt = *dlg.m_lstColPt[j]; // pDim->AddSegment(pt); // } // pDim->SwitchDimChord(); // pDim->AddToMSpace(Adesk::kTrue); //} //int nRow = dlg.m_lstRowPt.Length(); //if (nRow > 3) //{ // TDbDimension2 *pDim = new TDbDimension2; // pDim->setLayer(LAY_DIM_SPRINKLE); // pDim->SetDist2DimLine(-10); // pDim->SetLocation(*dlg.m_lstRowPt[1]); // pDim->SetStyleId(InitDimStyle(DS_LINEAR)); // pDim->SetRotation(ads_angle(*dlg.m_lstRowPt[2], *dlg.m_lstRowPt[1])); // for(int j = 1; j < nRow - 1; j++) // { // XPoint pt = *dlg.m_lstRowPt[j]; // pDim->AddSegment(pt); // } // pDim->AddToMSpace(Adesk::kTrue); //} } if(dlg.m_iConPipe == 1) //不接线 continue; if(dlg.m_iConPipe == 2) //接弧管 { XArc arc(ptStart, ptMid, ptEnd); arc.MidPoint(ptMid); XLine lineTmp(arc.GetCenterPt(), ptMid, 1); int row = dlg.m_iRowNum; for(int j=0;jm_lstPt[j]; pt2 = *jig.m_pDrawEnt->m_lstPt[len-row+j]; double dAng1 = ads_angle(arc.GetCenterPt(), pt1); double dAng2 = ads_angle(arc.GetCenterPt(), pt2); double dRadius = ads_distance(arc.GetCenterPt(), pt1); XArc arc1(arc.GetCenterPt(), dRadius, dAng1, dAng2); XArc arc2(arc.GetCenterPt(), dRadius, dAng2, dAng1); int ret1 = lineTmp.Intersection(&arc1, p1, p2); int ret2 = lineTmp.Intersection(&arc2, p1, p2); // 2段弧,究竟是哪1段呢? 从圆心到参考线中点的直线和哪根弧有交点,就是哪段弧 XArc arc0; if(ret1 == 1) arc0 = arc1; else arc0 = arc2; XPoint ptArcS, ptArcE; arc0.GetStartPoint(ptArcS); arc0.GetEndPoint(ptArcE); ptArcS.z = dlg.m_nEle * 1000; ptArcE.z = dlg.m_nEle * 1000; // zxl 2013.08.27 add if (ptArcS.Distance2d(ptArcE) < 0.001) { continue; } CDbPipe *pPipe = new CDbPipe; pPipe->SetPoints(ptArcS, ptArcE, arc0.Bulge()); // zxl 2011.11.29 modify // pPipe->setLayer(LAY_PIPE_SPRINKLE); // pPipe->setLinetype(GlobalFunc::GetPipeWireLayLineType(LAY_PIPE_SPRINKLE)); pPipe->setLayer(dlg.GetPipeLayer()); pPipe->setLinetype(GlobalFunc::GetPipeWireLayLineType(dlg.GetPipeLayer())); pPipe->SetPipeWeight(g_Option::instance().g_nPipeWidth[8]); pPipe->SetDnDiameter(g_Option::instance().g_iDefaultPipeDn); pPipe->SetModelType(TPipeSys::kModel); //zxl 2011.12.12 modify //pPipe->SetSysType(TPipeSys::kSprinkle); if (dlg.GetPipeLayer().Compare(LAY_PIPE_SPRINKLE) == 0) { pPipe->SetSysType(TPipeSys::kSprinkle); } else if (dlg.GetPipeLayer().Compare(LAY_PIPE_SPRINKLE2) == 0) { pPipe->SetSysType(TPipeSys::kSprinkle2); } else { pPipe->SetSysType(TPipeSys::kSprinkle3); } pPipe->SetRadius(g_Option::instance().g_nPipeRadius[8]); pPipe->setColor(AcCmColor()); //随层 GlobalFunc::AddToCurrentSpace(pPipe, Adesk::kTrue); } } else { int row = dlg.m_iRowNum; //接直管 int idx = 0; for(int j=0;jm_lstPt[idx]; pt2 = *jig.m_pDrawEnt->m_lstPt[idx+1]; idx++; if(idx % row == 0) continue; pt1.z = dlg.m_nEle * 1000; pt2.z = dlg.m_nEle * 1000; CDbPipe *pPipe = new CDbPipe; pPipe->SetStartPoint(pt1); pPipe->SetEndPoint(pt2); // pPipe->setLayer(LAY_PIPE_SPRINKLE); // pPipe->setLinetype(GlobalFunc::GetPipeWireLayLineType(LAY_PIPE_SPRINKLE)); pPipe->setLayer(dlg.GetPipeLayer()); pPipe->setLinetype(GlobalFunc::GetPipeWireLayLineType(dlg.GetPipeLayer())); pPipe->SetPipeWeight(g_Option::instance().g_nPipeWidth[8]); pPipe->SetDnDiameter(g_Option::instance().g_iDefaultPipeDn); pPipe->SetModelType(TPipeSys::kModel); //zxl 2011.12.12 modify //pPipe->SetSysType(TPipeSys::kSprinkle); if (dlg.GetPipeLayer().Compare(LAY_PIPE_SPRINKLE) == 0) { pPipe->SetSysType(TPipeSys::kSprinkle); } else if (dlg.GetPipeLayer().Compare(LAY_PIPE_SPRINKLE2) == 0) { pPipe->SetSysType(TPipeSys::kSprinkle2); } else { pPipe->SetSysType(TPipeSys::kSprinkle3); } pPipe->SetRadius(g_Option::instance().g_nPipeRadius[8]); pPipe->setColor(AcCmColor()); //随层 GlobalFunc::AddToCurrentSpace(pPipe, Adesk::kTrue); } } } // while end dlg.DestroyWindow();//命令取消, 强制执行反应器 SHads_command(RTSTR, _T(".REDRAW"), RTNONE); } ///////////////////////////////////////////////////////////////////////////// // CSprinklerBySectionDlg dialog IMPLEMENT_DYNAMIC(CSprinklerBySectionDlg, CDialog) int CSprinklerBySectionDlg::m_iConPipe = 1; int CSprinklerBySectionDlg::m_nPipeType = 0; double CSprinklerBySectionDlg::m_nColSpace = 3600; double CSprinklerBySectionDlg::m_nRowSpace = 3600; CSprinklerBySectionDlg::CSprinklerBySectionDlg(CWnd* pParent /*=NULL*/) : CDialog(CSprinklerBySectionDlg::IDD, pParent),m_spinRow(50), m_spinCol(50) { //{{AFX_DATA_INIT(CSprinklerBySectionDlg) m_bDrawCir = TRUE; m_nEle = 0.0; m_iCol = 3600; m_iRow = 3600; m_bNoBreak = 1; m_iLevel = 1; m_csRadius = _T("2.12"); m_nDist2Wall = 1700; m_bDim = FALSE; m_bInit = true; //}}AFX_DATA_INIT m_iRowNum = 0; m_iColNum = 0; m_nRadius = 0; } void CSprinklerBySectionDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSprinklerBySectionDlg) DDX_Control(pDX, IDC_EDIT_ELE, m_editEle); DDX_Control(pDX, IDC_EDIT_ROWNUM, m_editRow); DDX_Control(pDX, IDC_EDIT_COLNUM, m_editCol); DDX_Control(pDX, IDC_EDIT_DIST2WALL, m_editDist2Wall); DDX_Control(pDX, IDC_SPIN_ROW, m_spinRow); DDX_Control(pDX, IDC_SPIN_COL_DIST, m_spinCol); DDX_Check(pDX, IDC_CHECK_DRAW, m_bDrawCir); DDX_Text(pDX, IDC_EDIT_ELE, m_nEle); DDX_Text(pDX, IDC_EDIT_COLNUM, m_iCol); DDX_Text(pDX, IDC_EDIT_ROWNUM, m_iRow); DDX_Radio(pDX, IDC_RADIO_POS1, m_bNoBreak); DDX_CBIndex(pDX, IDC_COMBO_LEVEL, m_iLevel); DDX_CBString(pDX, IDC_COMBO_RADIUS, m_csRadius); DDX_Text(pDX, IDC_EDIT_DIST2WALL, m_nDist2Wall); DDX_Check(pDX, IDC_CHECK_DIM, m_bDim); DDX_CBIndex(pDX, IDC_COMBO_PIPE, m_iConPipe); DDX_CBIndex(pDX, IDC_COMBO_PIPETYPE, m_nPipeType); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CSprinklerBySectionDlg, CDialog) //{{AFX_MSG_MAP(CSprinklerBySectionDlg) ON_WM_CLOSE() ON_BN_CLICKED(IDC_CHECK_DRAW, OnCheckDraw) ON_CBN_SELCHANGE(IDC_COMBO_LEVEL, OnSelchangeComboLevel) ON_CBN_SELCHANGE(IDC_COMBO_PIPETYPE, OnSelchangeComboPipetype) ON_WM_DESTROY() ON_EN_KILLFOCUS(IDC_EDIT_COLNUM, OnKillfocusEditColnum) ON_EN_KILLFOCUS(IDC_EDIT_ROWNUM, OnKillfocusEditRownum) ON_CBN_KILLFOCUS(IDC_COMBO_RADIUS, OnKillfocusComboRadius) ON_EN_KILLFOCUS(IDC_EDIT_DIST2WALL, OnKillfocusEditDist2wall) ON_EN_KILLFOCUS(IDC_EDIT_ELE, OnKillfocusEditEle) ON_MESSAGE(WM_ACAD_KEEPFOCUS, onAcadKeepFocus) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSprinklerBySectionDlg message handlers BOOL CSprinklerBySectionDlg::OnInitDialog() { CDialog::OnInitDialog(); m_editRow.SetDataType(CRealEdit::eInteger); m_editCol.SetDataType(CRealEdit::eInteger); m_editEle.SetDataType(CRealEdit::eReal); m_editDist2Wall.SetDataType(CRealEdit::eReal); m_spinCol.SetRange(2400,5000); m_spinRow.SetRange(2400,5000); // cet 2012.12.19 add 读取注册表数据 ReadRegeditData(); UpdateData(FALSE); OnSelchangeComboLevel(); m_bInit = false; OnSelchangeComboPipetype();//zxl 2011.11.29 add return TRUE; // return TRUE unless you set the focus to a control // 求EXCEPTION: OCX Property Pages should return FALSE } void CSprinklerBySectionDlg::OnClose() { CDialog::OnClose(); acedPostCommand(_T("\33\33")); } void CSprinklerBySectionDlg::OnCheckDraw() { UpdateData(); CWnd *pWnd1 = GetDlgItem(IDC_COMBO_RADIUS); pWnd1->EnableWindow(m_bDrawCir); } void CSprinklerBySectionDlg::OnSelchangeComboLevel() { int iOldLevel = m_iLevel; UpdateData(TRUE); if (iOldLevel == 4 && !m_bInit) { m_nRowSpace = m_iRow; m_nColSpace = m_iCol; } if(m_iLevel == 0){ m_iCol = 4400; m_iRow = 4400; m_nDist2Wall = 2200; } else if(m_iLevel == 1){ m_iCol = 3600; m_iRow = 3600; m_nDist2Wall = 1800; } else if(m_iLevel == 2){ m_iCol = 3400; m_iRow = 3400; m_nDist2Wall = 1700; } else if(m_iLevel == 3){ m_iCol = 3000; m_iRow = 3000; m_nDist2Wall = 1500; } else if (m_iLevel == 4) { m_iCol = m_nColSpace; m_iRow = m_nRowSpace; } UpdateData(FALSE); } void CSprinklerBySectionDlg::OnSelchangeComboPipetype() { UpdateData(TRUE); if (m_nPipeType == 0) { m_sLayer = LAY_PIPE_SPRINKLE; } else if (m_nPipeType == 1) { m_sLayer = LAY_PIPE_SPRINKLE2; } else if (m_nPipeType == 2) { m_sLayer = LAY_PIPE_SPRINKLE3; } } CString CSprinklerBySectionDlg::GetPipeLayer() { return m_sLayer; } void CSprinklerBySectionDlg::ReadRegeditData() { TRegProperty regProp(_T("SoftWare\\SHANGHUASOFT\\2023"), _T("SHS-WTConfig")); regProp.SetTopRootKey(HKEY_CURRENT_USER); // 读取消防等级 regProp.GetValue(_T("SectorSprinklerLevel"), m_iLevel); regProp.GetValue(_T("SectorSprinklerColSpace"), m_nColSpace); regProp.GetValue(_T("SectorSprinklerRowSpace"), m_nRowSpace); } void CSprinklerBySectionDlg::WriteRegeditData() { TRegProperty regProp(_T("SoftWare\\SHANGHUASOFT\\2023"), _T("SHS-WTConfig")); regProp.SetTopRootKey(HKEY_CURRENT_USER); // 记录消防等级 regProp.SetValue(_T("SectorSprinklerLevel"), m_iLevel); if (m_iLevel == 4) { m_nRowSpace = m_iRow; m_nColSpace = m_iCol; } regProp.SetValue(_T("SectorSprinklerColSpace"), m_nColSpace); regProp.SetValue(_T("SectorSprinklerRowSpace"), m_nRowSpace); } void CSprinklerBySectionDlg::OnDestroy() { CDialog::OnDestroy(); WriteRegeditData(); } void CSprinklerBySectionDlg::OnKillfocusEditColnum() { double dData = m_iCol; CString sText; m_editCol.GetWindowText(sText); m_iCol = _tstof(sText); if (m_iCol <= 0 || !GlobalFunc::IsStrAllNum(sText)) { m_iCol = dData; UpdateData(FALSE); acedGetAcadDwgView()->SetFocus(); m_editCol.SetFocus(); m_editCol.SetSel(0, -1); } } void CSprinklerBySectionDlg::OnKillfocusEditRownum() { double dData = m_iRow; CString sText; m_editRow.GetWindowText(sText); m_iRow = _tstof(sText); if (m_iRow <= 0 || !GlobalFunc::IsStrAllNum(sText)) { m_iRow = dData; UpdateData(FALSE); acedGetAcadDwgView()->SetFocus(); m_editRow.SetFocus(); m_editRow.SetSel(0, -1); } } void CSprinklerBySectionDlg::OnKillfocusComboRadius() { CString csData = m_csRadius; CEdit *pWnd = (CEdit *)GetDlgItem(IDC_COMBO_RADIUS); if (pWnd == NULL) { return; } CString sText; pWnd->GetWindowText(sText); double dNewData = _tstof(sText); if (dNewData <= 0 || !GlobalFunc::IsStrAllNum(sText)) { m_csRadius = csData; UpdateData(FALSE); acedGetAcadDwgView()->SetFocus(); pWnd->SetFocus(); pWnd->SetSel(0, -1); } } void CSprinklerBySectionDlg::OnKillfocusEditDist2wall() { double dData = m_nDist2Wall; CString sText; m_editDist2Wall.GetWindowText(sText); m_nDist2Wall = _tstof(sText); if (m_nDist2Wall <= 0 || !GlobalFunc::IsStrAllNum(sText)) { m_nDist2Wall = dData; UpdateData(FALSE); acedGetAcadDwgView()->SetFocus(); m_editDist2Wall.SetFocus(); m_editDist2Wall.SetSel(0, -1); } } void CSprinklerBySectionDlg::OnKillfocusEditEle() { double dData = m_nEle; CString sText; m_editEle.GetWindowText(sText); m_nEle = _tstof(sText); if (sText.IsEmpty() || !GlobalFunc::IsStrAllNum(sText)) { m_nEle = dData; UpdateData(FALSE); acedGetAcadDwgView()->SetFocus(); m_editEle.SetFocus(); m_editEle.SetSel(0, -1); } } LONG_PTR CSprinklerBySectionDlg::onAcadKeepFocus(UINT_PTR, LONG_PTR) { POINT pt; ::GetCursorPos(&pt); CRect rect; GetWindowRect(&rect); if (!(rect.PtInRect(pt))) { return FALSE; } return TRUE; }