• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetSel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetSel函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSel函数的具体用法?C++ GetSel怎么用?C++ GetSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetSel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetWindowText

void CRichEditCtrlX::UpdateSyntaxColoring()
{
	CString strText;
	GetWindowText(strText);
	if (strText.IsEmpty())
		return;

	m_bSelfUpdate = true;

	long lCurSelStart, lCurSelEnd;
	GetSel(lCurSelStart, lCurSelEnd);
	SetSel(0, -1);
	SetSelectionCharFormat(m_cfDef);
	SetSel(lCurSelStart, lCurSelEnd);

	LPTSTR pszStart = const_cast<LPTSTR>((LPCTSTR)strText);
	LPCTSTR psz = pszStart;
	while (*psz != _T('\0'))
	{
		if (*psz == _T('\"'))
		{
			LPCTSTR pszEnd = _tcschr(psz + 1, _T('\"'));
			if (pszEnd)
				psz = pszEnd + 1;
			else
				break;
		}
		else
		{
			bool bFoundKeyword = false;
			for (int k = 0; k < m_astrKeywords.GetCount(); k++)
			{
				const CString& rstrKeyword = m_astrKeywords[k];
				int iKwLen = rstrKeyword.GetLength();
				if (_tcsncmp(psz, rstrKeyword, iKwLen)==0 && (psz[iKwLen]==_T('\0') || _tcschr(m_strSeperators, psz[iKwLen])!=NULL))
				{
					long iStart = static_cast<long>(psz - pszStart);
					long iEnd = static_cast<long>(iStart + iKwLen);
					long lCurSelStart, lCurSelEnd;
					GetSel(lCurSelStart, lCurSelEnd);
					SetSel(iStart, iEnd);
					SetSelectionCharFormat(m_cfKeyword);
					SetSel(lCurSelStart, lCurSelEnd);
					psz += iKwLen;
					bFoundKeyword = true;
					break;
				}
			}

			if (!bFoundKeyword)
				psz++;
		}
	}

	UpdateWindow();

	m_bSelfUpdate = false;
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:58,代码来源:RichEditCtrlX.cpp


示例2: GetItemCount

void WINAPI duListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	int nItemCount = GetItemCount();
	if (nItemCount == 0)
		return;

	if (nChar == VK_UP)
	{
		int nSel = GetSel();
		nSel--;
		if (nSel < 0)
			nSel = 0;
		if (nSel >= nItemCount)
			nSel = nItemCount - 1;

		SetSel(nSel);
		duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll);
		if (pScroll)
		{
			pScroll->SetPos(m_nItemHeight * nSel);
			UpdateScroll();
		}
		if (!m_fCombobox)
		{
			m_pHotItem = NULL;
			Plugin_Redraw(this, TRUE);
		}
		else
		{
			FadeRedraw();
		}
	}
	else if (nChar == VK_DOWN)
	{
		int nSel = GetSel();
		_TRACE(_T("nSel :%d\n"), nSel);
		nSel++;
		if (nSel >= nItemCount)
			nSel = nItemCount - 1;
		if (nSel < 0)
			nSel = 0;

		SetSel(nSel);
		duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll);
		if (pScroll)
		{
			pScroll->SetPos(m_nItemHeight * nSel);
			UpdateScroll();
		}
		if (!m_fCombobox)
		{
			m_pHotItem = NULL;
			Plugin_Redraw(this, TRUE);
		}
		else
			FadeRedraw();
	}
}
开发者ID:blueantst,项目名称:dulib,代码行数:58,代码来源:duListBox.cpp


示例3: MessageBeep

BOOL CMyDateEdit::CheckChar(UINT nChar)
{
	int nTime = 0;
	//如果不使用掩码,则返回
	if(!m_bUseMask)	return TRUE;
	//如果是控制字符,则返回
	if(!isprint(nChar)) return TRUE;
	if(!isdigit(nChar))	
	{
		MessageBeep((UINT)-1);
		return FALSE;
	}
	//如果存在选择区域,则取消选择
	int startPos,endPos;
	GetSel(startPos,endPos);
	SetSel(-1,0);
	//重新选中原选择区域的第一个字符
	SetSel(startPos,startPos);
	GetSel(startPos,endPos);
	//确保字符串的长度不超过掩码的长度
	if(endPos>=m_strMask.GetLength())
	{
		MessageBeep((UINT)-1);
		return FALSE;
	}
	//时间格式
	if(m_isTime)
	{
		if(!CheckTime(nChar,startPos,endPos))
		{
			return FALSE;
		}
	}
	//日期格式
	if(m_isDate)
	{
		if(!CheckDate(nChar,startPos,startPos))
		{
			return FALSE;
		}
	}
	if(m_isDateTime)
	{
		if(!CheckDate(nChar,startPos,startPos))
		{
			return FALSE;
		}
		if(!CheckTime(nChar,startPos,startPos))
		{
			return FALSE;
		}
	}
    return TRUE;
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:54,代码来源:MyDateEdit.cpp


示例4: GetSel

    void NativeTextfieldWin::OnAfterPossibleChange(bool should_redraw_text)
    {
        // Prevent the user from selecting the "phantom newline" at the end of the
        // edit.  If they try, we just silently move the end of the selection back to
        // the end of the real text.
        CHARRANGE new_sel;
        GetSel(new_sel);
        const int length = GetTextLength();
        if(new_sel.cpMax > length)
        {
            new_sel.cpMax = length;
            if(new_sel.cpMin > length)
            {
                new_sel.cpMin = length;
            }
            SetSel(new_sel);
        }

        std::wstring new_text(GetText());
        if(new_text != text_before_change_)
        {
            if(ime_discard_composition_ && ime_composition_start_>=0 &&
                ime_composition_length_>0)
            {
                // A string retrieved with a GetText() call contains a string being
                // composed by an IME. We remove the composition string from this search
                // string.
                new_text.erase(ime_composition_start_, ime_composition_length_);
                ime_composition_start_ = 0;
                ime_composition_length_ = 0;
                if(new_text.empty())
                {
                    return;
                }
            }
            textfield_->SyncText();
            UpdateAccessibleValue(textfield_->text());

            if(should_redraw_text)
            {
                CHARRANGE original_sel;
                GetSel(original_sel);
                std::wstring text = GetText();
                ScopedSuspendUndo suspend_undo(GetTextObjectModel());

                SelectAll();
                ReplaceSel(reinterpret_cast<LPCTSTR>(text.c_str()), true);
                SetSel(original_sel);
            }
        }
    }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:51,代码来源:native_textfield_win.cpp


示例5: GetWindowText

/////////////////////////////////////////////////////////////////////////////
// CMyDateEdit message handlers
void CMyDateEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	CString str;
	GetWindowText(str);
	for (int i = 0; i<str.GetLength() && i<m_str.GetLength();i++)
		m_str.SetAt(i, str.GetAt(i));
	if(!m_bMaskKeyInProgress)
		if(!CheckChar(nChar)) return;
		if(m_bUseMask)  //要使用掩码
		{
			if(isdigit(nChar))  //是可打印字符
			{
				int startPos,endPos;
				GetSel(startPos,endPos);
				SetSel(startPos,endPos+1);
				if(m_strMask.GetAt(startPos)=='-'||m_strMask.GetAt(startPos)==':'||m_strMask.GetAt(startPos)==' ')
				{
					SetSel(startPos+1,startPos+1);
					SendChar(nChar);
					return;
				}
			}
			else if(nChar==VK_BACK)
			{
				int startPos,endPos;
				GetSel(startPos,endPos);
				if((startPos==endPos) && (startPos>=1) && (startPos<=m_str.GetLength()))
				{
					char c;
					c=m_strMask.GetAt(startPos-1);
					if(c=='-'||c==':'||c==' ') 
					{					
						SetSel(startPos-1,startPos-1);
						return;
					}
					////回退光标
					SetSel(startPos-1,startPos-1);
					SendChar(c);
						//再次退回
					SendMessage(WM_KEYDOWN,VK_LEFT,0);
				}
				else   //越界或者存在选择区域
					MessageBeep((UINT)-1);
				return;
			}

		}
	CEdit::OnChar(nChar, nRepCnt, nFlags);
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:51,代码来源:MyDateEdit.cpp


示例6: GetWindowText

void CIntEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b')) {
		return;
	}

	CString str;
	GetWindowText(str);

	if (nChar == '-' && !str.IsEmpty() && str[0] == '-') {
		return;
	}

	int nStartChar, nEndChar;
	GetSel(nStartChar, nEndChar);

	if (nChar == '\b' && nStartChar <= 0) {
		return;
	}

	if (nChar == '-' && (nStartChar != 0 || nEndChar != 0)) {
		return;
	}

	CEdit::OnChar(nChar, nRepCnt, nFlags);
}
开发者ID:Samangan,项目名称:mpc-hc,代码行数:26,代码来源:FloatEdit.cpp


示例7: VERIFY

void CPropTreeItemFileEdit::OnContextMenu(CWnd *pWnd, CPoint point)
{

	CMenu FloatingMenu;
	VERIFY(FloatingMenu.LoadMenu(IDR_ME_EDIT_MENU));
	CMenu *pPopupMenu = FloatingMenu.GetSubMenu(0);

	if (CanUndo()) {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	DWORD dwSel = GetSel();

	if (HIWORD(dwSel) != LOWORD(dwSel)) {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:27,代码来源:PropTreeItemFileEdit.cpp


示例8: GetSel

void CPWL_Edit::PasteText() {
  if (!CanPaste())
    return;

  CFX_WideString swClipboard;
  if (IFX_SystemHandler* pSH = GetSystemHandler())
    swClipboard = pSH->GetClipboardText(GetAttachedHWnd());

  if (m_pFillerNotify) {
    FX_BOOL bRC = TRUE;
    FX_BOOL bExit = FALSE;
    CFX_WideString strChangeEx;
    int nSelStart = 0;
    int nSelEnd = 0;
    GetSel(nSelStart, nSelEnd);
    m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard,
                                       strChangeEx, nSelStart, nSelEnd, TRUE,
                                       bRC, bExit, 0);
    if (!bRC)
      return;
    if (bExit)
      return;
  }

  if (swClipboard.GetLength() > 0) {
    Clear();
    InsertText(swClipboard.c_str());
  }
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:29,代码来源:PWL_Edit.cpp


示例9: UNUSED_ALWAYS

void CFileListBox::OnContextMenu(CWnd* pWnd, CPoint point) 
{
    UNUSED_ALWAYS(pWnd);
	CMenu menu;
	menu.LoadMenu(IDR_TT_CONTEXTMENU);
	CMenu *pPopup=menu.GetSubMenu(0);
    /*
    ScreenToClient(&point);
    BOOL bOutside;
    m_nIndex=ItemFromPoint(point,bOutside);
    CRect rect;
    GetItemRect(m_nIndex,rect);
    if(bOutside || !rect.PtInRect(point)){
        pPopup->EnableMenuItem(IDC_TT_REMOVE,MF_BYCOMMAND|MF_GRAYED);
    }
    ClientToScreen(&point);
    */
    for(int i=0;i<GetCount();i++){
        if(GetSel(i)){
            break;
        }
    }
    if(i==GetCount()){
        pPopup->EnableMenuItem(IDC_TT_REMOVE,MF_BYCOMMAND|MF_GRAYED);
    }

	pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x,point.y,this);
}
开发者ID:Robertysc,项目名称:ecos,代码行数:28,代码来源:FileListBox.cpp


示例10: GetSel

LRESULT CUrlRichEditCtrl::OnDropFiles(WPARAM wp, LPARAM /*lp*/) 
{
	CHARRANGE crSelOrg;
	GetSel(crSelOrg); // save this off
	BOOL bEnable = !(GetStyle() & ES_READONLY) && IsWindowEnabled();
	
	if (!bEnable)
		return 0;
	
	CStringArray aFiles;
	CString sText;
	
	SetSel(m_crDropSel);
	
	int nNumFiles = FileMisc::GetDropFilePaths((HDROP)wp, aFiles);

	::DragFinish((HDROP)wp);
	::CloseClipboard();

	if (nNumFiles > 0)
		return CRichEditHelper::PasteFiles(*this, aFiles, REP_ASFILEURL);

	// else 
	return nNumFiles;
}
开发者ID:Fox-Heracles,项目名称:TodoList,代码行数:25,代码来源:urlricheditctrl.cpp


示例11: ScreenToClient

BOOL CFulEditCtrl::ShowMenu(HWND hWnd, POINT &pt){
	ScreenToClient(&pt);
	
	CHARRANGE cr;
	GetSel(cr);
	if(cr.cpMax != cr.cpMin) {
		TCHAR *buf = new TCHAR[cr.cpMax - cr.cpMin + 1];
		GetSelText(buf);
		searchTerm = Util::replace(buf, _T("\r"), _T("\r\n"));
		delete[] buf;
	} else {
		tstring line;
		tstring::size_type ch = TextUnderCursor(pt, line);
        if( ch != tstring::npos ) {
			
			tstring::size_type start = line.find_last_of(_T(" \t\r"), ch) + 1;
			
			tstring::size_type end = line.find_first_of(_T(" \t\r"), start);
			if(end == tstring::npos) {
				end = line.length();
			}

			searchTerm = line.substr(start, end-start);
		}
	}

	ClientToScreen(&pt);

	WinUtil::AppendSearchMenu(searchMenu);
	
	return menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, hWnd );
}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:32,代码来源:FulEditCtrl.cpp


示例12: GetParent

void CInPlaceFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    if (nChar == VK_ESCAPE || nChar == VK_RETURN) {
        if (nChar == VK_ESCAPE) {
            m_bESC = TRUE;
        }
        GetParent()->SetFocus();
        return;
    }

    if (nChar == ',') {
        nChar = '.';
    }

    if (!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b')) {
        return;
    }

    CString str;
    GetWindowText(str);

    if ((nChar == '.')  && str.Find('.') >= 0) {
        int nStartChar, nEndChar;
        GetSel(nStartChar, nEndChar);
        if (!(nStartChar < nEndChar && str.Mid(nStartChar, nEndChar - nStartChar).Find('.') >= 0)) {
            return;
        }
    }

    //CEdit::OnChar(nChar, nRepCnt, nFlags);
    DefWindowProc(WM_CHAR, nChar, MAKELONG(nRepCnt, nFlags));
}
开发者ID:Chris-Hood,项目名称:mpc-hc,代码行数:32,代码来源:PlayerListCtrl.cpp


示例13: GetObjectMgr

/*
 *	CTxtEdit::ObjectFromIOB
 *
 *	@mfunc	Gets an object based on an IOB type index.
 *
 *	@rdesc:
 *		pointer to COleObject or NULL if none.
 */
COleObject * CTxtEdit::ObjectFromIOB(LONG iob)
{
	COleObject * pobj = NULL;
	CObjectMgr * pobjmgr = NULL;

	pobjmgr = GetObjectMgr();

	if (!pobjmgr)
	{
		return NULL;
	}

	// Figure out the index of the selection
	if (iob == REO_IOB_SELECTION)
	{
		CTxtSelection * psel = GetSel();

		pobj = pobjmgr->GetFirstObjectInRange(psel->GetCpMin(),
			psel->GetCpMost());
	}
	else
	{
		// Make sure the IOB is in range
		if ((0 <= iob) && (iob < GetObjectCount()))
		{
			pobj = pobjmgr->GetObjectFromIndex(iob);
		}
	}

	return pobj;
}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:39,代码来源:object.cpp


示例14: GetSel

/*
================
CSyntaxRichEditCtrl::GetNameBeforeCurrentSelection
================
*/
bool CSyntaxRichEditCtrl::GetNameBeforeCurrentSelection(CString &name, int &charIndex) const
{
	long selStart, selEnd;
	int line, column, length;
	char buffer[1024];

	GetSel(selStart, selEnd);
	charIndex = selStart;
	line = LineFromChar(selStart);
	length = GetLine(line, buffer, sizeof(buffer));
	column = selStart - LineIndex(line) - 1;

	do {
		buffer[column--] = '\0';
	} while (charType[buffer[column]] == CT_WHITESPACE);

	for (length = 0; length < column; length++) {
		if (charType[buffer[column-length-1]] != CT_NAME) {
			break;
		}
	}

	if (length > 0) {
		name = buffer + column - length;
		return true;
	}

	return false;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:34,代码来源:CSyntaxRichEditCtrl.cpp


示例15: dlg

void CPropTreeItemFileEdit::OnInsertFile()
{
	CFileDialog dlg(TRUE);
	dlg.m_ofn.Flags |= OFN_FILEMUSTEXIST;

	int startSel, endSel;
	GetSel(startSel, endSel);

	if (dlg.DoModal()== IDOK) {

		idStr currentText = (char *)GetItemValue();
		idStr newText = currentText.Left(startSel) + currentText.Right(currentText.Length() - endSel);

		idStr filename = fileSystem->OSPathToRelativePath(dlg.m_ofn.lpstrFile);
		filename.BackSlashesToSlashes();


		newText.Insert(filename, startSel);

		SetItemValue((LPARAM)newText.c_str());
		m_pProp->RefreshItems(this);

		m_pProp->SendNotify(PTN_ITEMCHANGED, this);

	}
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:26,代码来源:PropTreeItemFileEdit.cpp


示例16: CharFromPos

void CTitleTimeEdit::KeyInDel()
{
    int nCharPos = CharFromPos(GetCaretPos());

    int nSelStart	= 0;
    int nSelEnd		= 0;
    GetSel(nSelStart, nSelEnd);

    if(nSelStart == nSelEnd)
    {
        if(nCharPos < 12)
        {
            m_szTimeChar[nCharPos] = s_szDefTMChar[nCharPos];
            nCharPos ++;
            if(s_szDefTMChar[nCharPos] != '0')
                nCharPos ++;
        }
    }
    else
    {
        DeleteRange(nSelStart, nSelEnd);
    }
    Update();
    SetSel(nCharPos, nCharPos);
}
开发者ID:BennyThink,项目名称:TimeM,代码行数:25,代码来源:TitleTimeEdit.cpp


示例17: LineFromPos

LRESULT ChatCtrl::OnRButtonDown(POINT pt) {
	selectedLine = LineFromPos(pt);
	selectedUser.clear();
	selectedIP.clear();

	// Po kliku dovnitr oznaceneho textu si zkusime poznamenat pripadnej nick ci ip...
	// jinak by nam to neuznalo napriklad druhej klik na uz oznaceny nick =)
	long lSelBegin = 0, lSelEnd = 0;
	GetSel(lSelBegin, lSelEnd);

	int iCharPos = CharFromPos(pt), iBegin = 0, iEnd = 0;
	if((lSelEnd > lSelBegin) && (iCharPos >= lSelBegin) && (iCharPos <= lSelEnd)) {
		if(!HitIP(pt, selectedIP, iBegin, iEnd))
			HitNick(pt, selectedUser, iBegin, iEnd);

		return 1;
	}

	// hightlight IP or nick when clicking on it
	if(HitIP(pt, selectedIP, iBegin, iEnd) || HitNick(pt, selectedUser, iBegin, iEnd)) {
		SetSel(iBegin, iEnd);
		InvalidateRect(NULL);
	}
	return 1;
}
开发者ID:Dimetro83,项目名称:DC_DDD,代码行数:25,代码来源:ChatCtrl.cpp


示例18: AfxCallWndProc

void CGuiEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	if (!m_szMask.IsEmpty())
	{
		if (nChar == VK_DELETE) 
		{
			m_KeySpecial=1;
			AfxCallWndProc(this, m_hWnd, WM_CHAR, ' ', 1);
			return;
		}
		if (nChar == VK_BACK) 
		{
			m_KeySpecial=2;
			return;
		}
		if(nChar == VK_RIGHT)
		{
			int nStartPos, nEndPos;
			GetSel( nStartPos, nEndPos ); 
			m_KeySpecial=3;
			if (!ValSpecialKey(nStartPos,nEndPos))
				SetSel(nStartPos,nStartPos);	
			else
			{
				int nNext = GetNextPos(nStartPos);
				SetSel(nNext,nNext);	
			}
			return;
		}
			
		
	}
	CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
开发者ID:ZhaoboMeng,项目名称:k-line-print,代码行数:35,代码来源:GuiEdit.cpp


示例19: GetSel

void CEditInt::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
  DWORD dw = GetSel();

  switch(nChar) {
    case _T('+'):
    case _T('-'):
      if (LOWORD(dw) != 0)
        return;
      break;
    case _T('0'):
    case _T('1'):
    case _T('2'):
    case _T('3'):
    case _T('4'):
    case _T('5'):
    case _T('6'):
    case _T('7'):
    case _T('8'):
    case _T('9'):
    case _T('\b'):
      break;
    default:
      return;
  }

  CEdit::OnChar(nChar, nRepCnt, nFlags);
}
开发者ID:wcremeika,项目名称:thesis,代码行数:28,代码来源:FilterDateDlg.cpp


示例20: bstr

/*
================
CSyntaxRichEditCtrl::ReplaceAll
================
*/
int CSyntaxRichEditCtrl::ReplaceAll( const char *find, const char *replace, bool matchCase, bool matchWholeWords ) {
	long selStart, selEnd, flags, search, length, start;
	int numReplaced;
	tom::ITextRange *range;
	CComBSTR bstr( find );

	if ( find[0] == '\0' ) {
		return 0;
	}

	m_TextDoc->Freeze( NULL );

	GetSel( selStart, selEnd );

	flags = 0;
	flags |= matchCase ? tom::tomMatchCase : 0;
	flags |= matchWholeWords ? tom::tomMatchWord : 0;

	m_TextDoc->Range( 0, GetTextLength(), &range );
	search = GetTextLength();

	numReplaced = 0;
	while( range->FindShit( bstr, search, flags, &length ) == S_OK ) {
		range->get_Start( &start );
		ReplaceText( start, start + length, replace );
		numReplaced++;
	}

	range->Release();

	m_TextDoc->Unfreeze( NULL );

	return numReplaced;
}
开发者ID:RobertBeckebans,项目名称:fhDOOM,代码行数:39,代码来源:CSyntaxRichEditCtrl.cpp



注:本文中的GetSel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetSelected函数代码示例发布时间:2022-05-30
下一篇:
C++ GetSecurityStatusString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap