当前位置: 首页>>代码示例>>C++>>正文


C++ DeleteString函数代码示例

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


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

示例1: sString

// this version of AddString adds a string only if it doesn't already exist
// in the list, and in any case, makes sure that the string is the first
// in the list (ie most recent in history)
// also makes sure number of items in the list doesn't exceed the maximum allowed
int CHistoryCombo::AddString(LPCTSTR lpszString)
{
	CString sString(lpszString);

	// if it's not set up as a history combo then call base class
	if (m_sSection.IsEmpty() || m_sKeyPrefix.IsEmpty())
		return CComboBox::AddString(lpszString);

	int nRet = -1;

	// don't add if already there
	sString.TrimLeft();
	sString.TrimRight();

	if (sString.IsEmpty())
	{
		TRACE(_T("ERROR  string is empty\n"));
		return CB_ERR;
	}

	nRet = CComboBox::InsertString(0, sString);
	int nIndex = FindStringExact(0, sString);
	if (nIndex != -1 && nIndex != 0)
		DeleteString(nIndex);

	// if we've got too many items then delete the last one
	// truncate list to m_nMaxHistoryItems
	int nNumItems = GetCount();
	for (int n = m_nMaxHistoryItems; n < nNumItems; n++)
		DeleteString(m_nMaxHistoryItems);

	SetCurSel(nRet);
	return nRet;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:38,代码来源:XHistoryCombo.cpp

示例2: FiniProfile

/*
 * FiniProfile - free the profile path strings
 */
void FiniProfile( void )
{
    DeleteString( &cfgFile );
    DeleteString( &iniFile );
    DeleteString( &iniPath );

} /* FiniProfile */
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:10,代码来源:profile.c

示例3: switch

BOOL CSplitPointList::OnCommand(WPARAM wParam, LPARAM lParam)
{
    // TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen
    AddSplitPointDlg*	aspd;
    DWORD				dwSplitPos;
    int					iIndex;
    char				Buffer[200];

    switch (LOWORD(wParam))
    {
    case IDM_ADDSPLITPOINT:
        aspd=new AddSplitPointDlg;
        aspd->SetSplitPos(0);
        if (aspd->DoModal())
        {
            dwSplitPos=aspd->GetSplitPos();
            if (CheckSplitPoint(dwSplitPos)) AddSplitPoint(dwSplitPos);
        }
        delete aspd;
        break;
    case IDM_REMOVESPLITPOINT:
        iIndex=GetCurSel();
        if (iIndex!=LB_ERR)
        {
            DeleteString(iIndex);
        }
        break;
    case IDM_CHANGESPLITPOINT:
        iIndex=GetCurSel();
        if (iIndex!=LB_ERR)
        {
            GetText(iIndex,Buffer);
            aspd=new AddSplitPointDlg;
            aspd->SetSplitPos(atoi(Buffer));
            if (aspd->DoModal())
            {
                dwSplitPos=aspd->GetSplitPos();
                if (CheckSplitPoint(dwSplitPos))
                {
                    DeleteString(iIndex);
                    AddSplitPoint(dwSplitPos);
                }
            }
            delete aspd;
        }
        break;
    }

    return CListBox::OnCommand(wParam, lParam);
}
开发者ID:BrunoReX,项目名称:avimuxgui,代码行数:50,代码来源:SplitPointList.cpp

示例4: FindStringExact

int CSmartComboBox::AddString(LPCTSTR str)
{
	if( _tcslen(str) == 0 )
		return -1;

	int oldIndex = FindStringExact(-1, str);
	if( oldIndex >= 0 )
		DeleteString(oldIndex);

	if( GetCount() == m_nMaxStrings )
		DeleteString(m_nMaxStrings-1);

	return CComboBox::InsertString(0, str);
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:14,代码来源:ToolBarEx.cpp

示例5: DeleteChannel

void DeleteChannel(channel *Channel) {

   if (Channel == NULL) {
      Error("DeleteChannel(): Channel = NULL");
      return;
   } else if (Channel->Type != CHANNEL) {
      Error("DeleteChannel(): \"%s\" is not a channel",Channel->Id);
      return;
   }

   DeleteString(&Channel->Id);
   DeleteString(&Channel->Topic);

   free(Channel);
}
开发者ID:StraToN,项目名称:tux-target,代码行数:15,代码来源:channel.c

示例6: GetNextPos

void CGuiEdit::AjustaCadena(int nStartPos,int  nEndPos )
{
	
	int numCharMove=0;
	int LastChar=FindLasCharR(); //el ultimo caracter valido de la cadena
	int LastCharDel=LastChar;
	int init =nStartPos;
	for (int i=nStartPos; i <= LastChar; i++)
	{
			int nNext = GetNextPos(nStartPos);
			if (IsValidChar(m_szShowMask.GetAt(i),nNext) || m_szShowMask.GetAt(i)==m_cadResult.GetAt(i))//el caracter se puede mover a esa posicion			
			{
				//se mueve el caracter
				m_szShowMask.SetAt(nStartPos,m_szShowMask.GetAt(nNext));			
				//se reemplaza la ultima posicion despues del ultimo caracter con el
				//equivalente en la mascara
				//obtenemos la proxima posicion donde se moveria el proximo caracter
				nStartPos = GetNextPos(nStartPos);
				numCharMove++;
			}
		
	}
	DeleteString(LastCharDel,LastCharDel);
	SetSel(init,init);	
	m_KeySpecial=0;

}
开发者ID:ZhaoboMeng,项目名称:k-line-print,代码行数:27,代码来源:GuiEdit.cpp

示例7: ASSERT_VALID

BOOL COXHistoryCombo::DeleteItem(int nItemIndex /* = -1 */)
{
	ASSERT_VALID(this);

	if (nItemIndex == -1)
		// ... No index was specified, get the current selection
		nItemIndex = GetCurSel();

	BOOL bSuccess = (DeleteString(nItemIndex) != CB_ERR);

	if (bSuccess)
	{
		// Select the next item if it exists
		if (nItemIndex < GetCount())
		{
			// ... Items have shifted up, select the same index
			SetCurSel(nItemIndex);

			CWnd* pParentWnd=GetParent();
			if(pParentWnd!=NULL)
			{
				pParentWnd->SendMessage(WM_COMMAND,
					MAKEWPARAM(GetDlgCtrlID(),CBN_SELCHANGE),(LPARAM)GetSafeHwnd());
			}
		}
		else
			// ... Last item was deleted, select the current last one (may not exist if the list is empty)
			SetCurSel(nItemIndex - 1);
	}
	return bSuccess;
}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:31,代码来源:OXHistoryCombo.cpp

示例8: GetWindowText

BOOL CUrlBox::PreTranslateMessage(MSG* pMsg)
{
	if ((pMsg->message != WM_KEYDOWN))
		return CComboBox::PreTranslateMessage(pMsg);

    if (pMsg->wParam != VK_RETURN)
       return CComboBox::PreTranslateMessage(pMsg);

	// when the enter key is hit in the ComboBox we want to add the string
	// to the top of the list and hilight it.  We also want to limit the
	// list to the last 15 entries.
	if ((pMsg->lParam & 0x40000000) == 0)   // Not a repeat.
	{
		CString strText;
		GetWindowText(strText);

		InsertString(0, strText);
		SetCurSel(0);
      
      m_curSel = 0;

		if (GetCount() > 150)
			DeleteString(GetCount()-1);


      CMyglView* pView = ((CMyglApp *) AfxGetApp())->GetActiveView();
      if (pView) { pView->ReadUrl( strText); }

	}
	return TRUE;
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:31,代码来源:mainfrm.cpp

示例9: DeleteString

/*
 * Elimina un nodo del árbol.
 */
void DeleteString(int p) {
  int  replacement;
  /* Si el nodo a borrar no está en el árbol, no hacemos nada. */
  if ( tree[ p ].parent == UNUSED )
    return;
  /* Si el nodo a borrar sólo tiene un hijo, hacemos una contracción
     del árbol. */
  if ( tree[ p ].larger_child == UNUSED )
    ContractNode( p, tree[ p ].smaller_child );
  else if ( tree[ p ].smaller_child == UNUSED )
    ContractNode( p, tree[ p ].larger_child );
  /* Si el nodo a borrar tiene ambos descendientes. */
  else {
    /* Localizamos el siguiente nodo más pequeño que el nodo que
       intentamos borrar. */
    replacement = FindNextNode( p );
    /* Eliminaos el siguiente nodo más pequeño del árbol. Nótese que
       el nodo "replacemente" nunca va a tener los dos descendientes,
       lo que evita entrar en más de un nivel de recursión. */
    DeleteString( replacement );
    /* Sustituimos el nodo que estamos intentanbo borrar por el que
       acabamos de localizar y eliminar el árbol. */
    ReplaceNode( p, replacement );
  }
}
开发者ID:vicente-gonzalez-ruiz,项目名称:basic-compression-tools,代码行数:28,代码来源:lzss.c

示例10: while

void CProgressListBox::UpdateItems(int nLimit, bool bUpdateSize)
{
	// delete items from array
	if(m_vItems.size() > nLimit)
	{
		std::vector<_PROGRESSITEM_*>::iterator iterStart = m_vItems.begin() + nLimit;
		for(std::vector<_PROGRESSITEM_*>::iterator iterPos = iterStart; iterPos != m_vItems.end(); ++iterPos)
		{
			delete *iterPos;
		}
		m_vItems.erase(iterStart, m_vItems.end());
	}
	// change count of elements in a listbox
	if (GetCount() != m_vItems.size())
	{
		while (GetCount() < m_vItems.size())
			AddString(_T(""));

		while (GetCount() > m_vItems.size())
			DeleteString(m_vItems.size());
	}

	if (bUpdateSize)
	{
		Invalidate();
		RecalcHeight();
	}
}
开发者ID:alphaonex86,项目名称:Copy-handler,代码行数:28,代码来源:ProgressListBox.cpp

示例11: DeleteString

void CBetPoolListBox::DeleteIndex(int iIndex)
{
	PoolBox_AppendData * pData = (PoolBox_AppendData *)GetItemDataPtr(iIndex);

	if ( NULL != pData ) {
		delete pData->pSta0;
		pData->pSta0 = NULL ;

		delete pData->pBut2;
		pData->pBut2 = NULL ;

		delete pData->pSta1;
		pData->pSta1 = NULL ;

		delete pData->pSta3;
		pData->pSta3 = NULL;

		delete pData->pSta2;
		pData->pSta2 = NULL ;

		delete pData;
		pData = NULL;
	}

	DeleteString(iIndex);
	button_betmap::iterator iter = m_mButton.find(iIndex);
	if (iter != m_mButton.end())
	{
		m_mButton.erase(iter);
	}

}
开发者ID:SoyPay,项目名称:DacrsUI,代码行数:32,代码来源:BetPoolListBox.cpp

示例12: GetText

int CListBoxST::Move(int nOldIndex, int nNewIndex, BOOL bSetCurSel)
{
	int				nInsertedIndex = LB_ERR;
	CString			sText;
	STRUCT_LBDATA*	lpLBData = NULL;
	STRUCT_LBDATA 	csLBData;

	// If index is out of range
	if ((UINT)nOldIndex >= (UINT)GetCount())	return LB_ERR;

	// Get item text
	GetText(nOldIndex, sText);
	// Get associated data
	::ZeroMemory(&csLBData, sizeof(csLBData));
	lpLBData = (STRUCT_LBDATA*)CListBox::GetItemData(nOldIndex);
	if (lpLBData != (LPVOID)-1L)
	{
		::CopyMemory(&csLBData, lpLBData, sizeof(csLBData));
	} // if
	// Delete string
	DeleteString(nOldIndex);
	// Insert string at new position
	nInsertedIndex = InsertString(nNewIndex, sText);
	// Restore associated data
	ReplaceItemData(nInsertedIndex, csLBData.dwItemData, csLBData.pData, csLBData.nImage, csLBData.dwFlags, MASK_ALL);

	// Select item
	if (bSetCurSel && nInsertedIndex != LB_ERR && nInsertedIndex != LB_ERRSPACE)
		SetCurSel(nInsertedIndex);

	return nInsertedIndex;
} // End of Move
开发者ID:musclecui,项目名称:Solution1,代码行数:32,代码来源:ListBoxST.cpp

示例13: CompressFile

void CompressFile ( FILE *input, BFILE *output)
{
	int i;
	int c;
	int look_ahead_bytes;
	int current_pos;
	int replace_count;
	int match_len;
	int match_pos;
	
	current_pos = 1;
	
	for ( i = 0; i < LOOK_AHEAD_SIZE; i++)
	{
		if ( (c = getc (input)) == EOF )
			break;
		window [current_pos + i] = (uchar) c;
	}
	
	look_ahead_bytes = i;
	InitTree (current_pos);
	match_len = 0;
	match_pos = 0;
	
	while (look_ahead_bytes > 0)
	{
		if (match_len > look_ahead_bytes)
			match_len = look_ahead_bytes;
		if (match_len <= BREAK_EVEN)
		{
			replace_count = 1;
			WriteBit ( output, 1);
			WriteBits ( output, (ulong) window [current_pos], 8);
		}
		else
		{
			WriteBit  ( output, 0);
			WriteBits ( output, (ulong) match_pos, INDEX_BITS);
			WriteBits ( output, (ulong) ( match_len - (BREAK_EVEN + 1)),
				LENGTH_BITS);
			replace_count = match_len;
		}
		
		for ( i = 0; i < replace_count; i++)
		{
			DeleteString ( MODULO (current_pos + LOOK_AHEAD_SIZE));
			if ( (c = getc (input)) == EOF )
				look_ahead_bytes--;
			else
				window [MODULO (current_pos + LOOK_AHEAD_SIZE)] = (uchar) c;
			current_pos = MODULO (current_pos + 1);
			if (look_ahead_bytes)
				match_len = AddString ( current_pos, &match_pos);
		}
	}
	
	WriteBit  ( output, 0);
	WriteBits ( output, (ulong) END_OF_STREAM, INDEX_BITS);
}
开发者ID:kilitary,项目名称:ss,代码行数:59,代码来源:lzss.cpp

示例14: GetLineNo

//@doc SECEdit
//@mfunc Internal function.  Cuts the column of text from pStartPos to pEndPos, 
//              from column pStartPos->iOffset to pEndPos->iOffset.
//@rdesc int 
//@parm PTEXTPOS pStartPos
//@parm  PTEXTPOS pEndPos
//@parm  BOOL bSaveUndoRecord
int SECEdit::ColumnCut(PTEXTPOS pStartPos, PTEXTPOS pEndPos, BOOL bSaveUndoRecord)
   {
   int iRval;
   UNDORECORD UndoRecord;
   LPSTR lpText;
   PLINEDESC pLine;
   TEXTPOS TextPos;
   TEXTPOS StartPos,EndPos;

   if (m_bReadOnly)
      return IDS_OE_READONLY;

   // column blocks may not be in order...
   if (!InOrder(pStartPos,pEndPos))
      {
      StartPos = *pEndPos;
      EndPos = *pStartPos;
      }
   else
      {
      StartPos = *pStartPos;
      EndPos = *pEndPos;
      }

   iRval = 0;

	UndoRecord.iCol    = StartPos.iOffset;
	UndoRecord.iEndCol = EndPos.iOffset;

	if (bSaveUndoRecord)
		{
		UndoRecord.iRow    = GetLineNo(StartPos.pLine);
		UndoRecord.iEndRow = GetLineNo(EndPos.pLine);
		UndoRecord.iUndoType = OE_UNDO_COLUMNCUT;
		lpText = ColumnCopy(&StartPos, &EndPos, FALSE);
		}

	int iTabbedOffset = GetTabbedOffset(StartPos.pLine,StartPos.iOffset);
	int iCount = UndoRecord.iEndCol - UndoRecord.iCol;
   pLine = StartPos.pLine;
   while (pLine)
      {
      TextPos.pLine = pLine;
		TextPos.iOffset = GetRealOffset(TextPos.pLine,iTabbedOffset);
      iRval = DeleteString(&TextPos, iCount, FALSE);
		if (pLine == EndPos.pLine)
			break;
		pLine = pLine->pNext;
      }

   if (!iRval && bSaveUndoRecord)
		{
      SaveUndoRecord(&UndoRecord, lpText);
		free(lpText);
		}

   return iRval;
   }
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:65,代码来源:EditCut.cpp

示例15: GetCount

void CHistoryCombo::SetMaxHistoryItems(int nMaxItems)
{
	m_nMaxHistoryItems = nMaxItems;

	//truncate list to nMaxItems
	int nNumItems = GetCount();
	for (int n = m_nMaxHistoryItems; n < nNumItems; n++)
		DeleteString(m_nMaxHistoryItems);
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:9,代码来源:HistoryCombo.cpp


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