本文整理汇总了C++中CStringList::AddHead方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::AddHead方法的具体用法?C++ CStringList::AddHead怎么用?C++ CStringList::AddHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::AddHead方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEditTemplate
void CClientListCtrl::OnEditTemplate( LPCTSTR templateName )
{
// Get a list of all clients, so the dialog can check
// for a bungle like trying to create a client that
// already exists
CStringList list;
int index=-1;
m_NewClicked=m_NewClient=FALSE;
if( GET_SERVERLEVEL() >= 6 )
list.AddHead( templateName );
else
{
while(1)
{
index=GetNextItem(index, LVNI_ALL);
if( index == -1)
break;
TCHAR str[ 1024 ];
GetItemText(index, 0, str, 1024 );
list.AddHead(str);
}
}
// Prompt for the new client name, using p4client as a
// default value
CTemplateNameDlg dlg;
dlg.SetTemplateName(templateName);
dlg.SetVerbotenSpecNames(&list);
dlg.SetNewSpecName(GET_P4REGPTR()->GetP4Client( ));
dlg.SetSpecType( P4CLIENT_SPEC );
if(dlg.DoModal() != IDCANCEL)
{
CString saveActive = m_Active;
m_Active = dlg.GetNewSpecName(); //set and switch to new client
if (SetP4Client( TRUE ))
{
m_pNewSpec= new CP4Client;
CCmd_EditSpec *pCmd= new CCmd_EditSpec;
pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
if( pCmd->Run( P4CLIENT_SPEC, m_Active, templateName, m_pNewSpec ) )
{
MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_CLIENT_SPEC) ) ;
m_NewClicked = m_NewClient = TRUE;
m_ClientNew = m_Active;
}
else
{
delete pCmd;
delete m_pNewSpec;
m_Active = saveActive;
SetP4Client( TRUE );
}
}
}
}
示例2: PreProcess
void CCmd_PrepEdit::PreProcess(BOOL& done)
{
Error e;
CStringList files;
CString temp;
// Get the file at head if required
if(m_GetHead)
{
CCmd_Get *pCmd1= new CCmd_Get(m_pClient);
pCmd1->Init(m_ReplyWnd, RUN_SYNC, HOLD_LOCK);
pCmd1->SetOpeningForEdit(TRUE);
temp= m_FileName+_T("#head");
files.AddHead(temp);
if(pCmd1->Run(&files, FALSE) )
m_FatalError= pCmd1->GetError();
else
{
delete pCmd1;
m_ErrorTxt= _T("Unable to run Sync");
m_FatalError=TRUE;
return;
}
pCmd1->CloseConn(&e);
// Make sure depot window gets updated (and pCmd1 is deleted)
::PostMessage( m_ReplyWnd, pCmd1->GetReplyMsg(), (WPARAM) pCmd1, 0);
}
// Edit the file
CCmd_ListOpStat *pCmd2= new CCmd_ListOpStat(m_pClient);
pCmd2->Init(m_ReplyWnd, RUN_SYNC);
pCmd2->SetWarnIfLocked(m_WarnIfLocked);
files.RemoveAll();
files.AddHead(m_FileName);
if(pCmd2->Run(&files, m_AddFile ? P4ADD : P4EDIT) )
m_FatalError= pCmd2->GetError();
else
{
delete pCmd2;
m_ErrorTxt= _T("Unable to run Edit");
m_FatalError=TRUE;
return;
}
pCmd2->CloseConn(&e);
// Make sure depot window gets updated (and pCmd1 is deleted)
::PostMessage( m_ReplyWnd, pCmd2->GetReplyMsg(), (WPARAM) pCmd2, 0);
// Note:
// By setting done=TRUE, we prevent the main ExecCommand loop from running,
// so this command will consist only of the subcommands that were invoked
// in PreProcess()
done=TRUE;
}
示例3: OnLabelTemplate
void CLabelListCtrl::OnLabelTemplate()
{
if( SERVER_BUSY() || m_Active.IsEmpty() || m_EditInProgress || GET_SERVERLEVEL() < 6)
return;
CStringList list;
m_Active= GetSelectedItemText();
list.AddHead( m_Active );
// Prompt for the new label name
CTemplateNameDlg dlg;
dlg.SetTemplateName( m_Active );
dlg.SetVerbotenSpecNames(&list);
dlg.SetNewSpecName(_T(""));
dlg.SetSpecType( P4LABEL_SPEC );
if(dlg.DoModal() != IDCANCEL)
{
CString newName=dlg.GetNewSpecName();
// Let OnP4LabelSpec() determine if this is a new label
m_NewLabel=TRUE;
m_pNewSpec= new CP4Label;
CCmd_EditSpec *pCmd= new CCmd_EditSpec;
pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
if( pCmd->Run( P4LABEL_SPEC, newName, m_Active, m_pNewSpec ) )
MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_LABEL_SPEC) );
else
{
delete pCmd;
delete m_pNewSpec;
}
}
}
示例4: OnInitDialog
BOOL CWindowPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
TRANSLATE(*this, IDD);
m_wndSpinTextLen.SetRange32(1, TT_STRLEN);
//convert font to LOGFONT
ConvertFont(m_Font, m_lf);
ShowFont();
CStringList strings;
GetLanguageFiles(strings);
strings.AddHead(_T(""));
for(POSITION pos=strings.GetHeadPosition();pos!=NULL;)
m_wndLanguages.AddString(strings.GetNext(pos));
if(!m_szLanguage.IsEmpty())
m_wndLanguages.SelectString(-1, m_szLanguage);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例5: RegisterTGitSounds
void CSoundUtils::RegisterTGitSounds()
{
// create the event labels
CRegString eventlabelerr = CRegString(_T("AppEvents\\EventLabels\\TGit_Error\\"));
eventlabelerr = CString(MAKEINTRESOURCE(IDS_ERR_ERROR));
CRegString eventlabelwarn = CRegString(_T("AppEvents\\EventLabels\\TGit_Warning\\"));
eventlabelwarn = CString(MAKEINTRESOURCE(IDS_WARN_WARNING));
CRegString eventlabelnote = CRegString(_T("AppEvents\\EventLabels\\TGit_Notification\\"));
eventlabelnote = CString(MAKEINTRESOURCE(IDS_WARN_NOTE));
CRegString appscheme = CRegString(_T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\"));
appscheme = _T("TortoiseGit");
CString apppath = CPathUtils::GetAppDirectory();
CRegistryKey schemenamekey = CRegistryKey(_T("AppEvents\\Schemes\\Names"));
CStringList schemenames;
schemenamekey.getSubKeys(schemenames);
// if the sound scheme has been modified but not save under a different name,
// the name of the sound scheme is ".current" and not under the names list.
// so add the .current scheme to the list too
schemenames.AddHead(_T(".current"));
POSITION pos;
for (pos = schemenames.GetHeadPosition(); pos != NULL;)
{
CString name = schemenames.GetNext(pos);
if ((name.CompareNoCase(_T(".none"))!=0)&&(name.CompareNoCase(_T(".nosound"))!=0))
{
CString errorkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Error\\") + name + _T("\\");
CRegString errorkeyval = CRegString(errorkey);
if (((CString)(errorkeyval)).IsEmpty())
{
errorkeyval = apppath + _T("TortoiseGit_Error.wav");
}
CString warnkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Warning\\") + name + _T("\\");
CRegString warnkeyval = CRegString(warnkey);
if (((CString)(warnkeyval)).IsEmpty())
{
warnkeyval = apppath + _T("TortoiseGit_Warning.wav");
}
CString notificationkey = _T("AppEvents\\Schemes\\Apps\\TortoiseGitProc\\TGit_Notification\\") + name + _T("\\");
CRegString notificationkeyval = CRegString(notificationkey);
if (((CString)(notificationkeyval)).IsEmpty())
{
notificationkeyval = apppath + _T("TortoiseGit_Notification.wav");
}
}
}
}
示例6: OnInitDialog
BOOL CGroupSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString Buff;
CStringList SelC;
//m_Name=m_pE->GetName();
POSITION pos = m_pE->m_agr.GetHeadPosition();
while (pos!=NULL)
{
Buff=((CExponent*) m_pE->m_agr.GetNext(pos))->GetName();
m_CurList.InsertString(-1, Buff);
SelC.AddHead(Buff);
}
pos = m_pAllE->GetHeadPosition();
while (pos!=NULL)
{
Buff=((CExponent*) m_pAllE->GetNext(pos))->GetName();
if ((SelC.Find(Buff)==NULL)&&(Buff!=m_pE->GetName()))
m_AllList.InsertString(-1,Buff);
}
int n=m_F.Count;
int* IDs= new int[n];
CComboBox* pCB=(CComboBox*)GetDlgItem(IDC_COMBO_METHOD);
pCB->ResetContent();
m_F.GetAllID(IDs);
for (int i=0; i<n; i++)
{
if (m_F.GetTypeLex(IDs[i],Buff))
AfxMessageBox("ќшибка в определении методов");
else pCB->AddString(Buff);
}
delete [] IDs;
if (m_pE->m_Method==NULL) n=0;
else
{
m_F.GetTypeLex(m_pE->m_Method->GetType(),Buff);
n=pCB->FindString(-1,Buff);
}
if (pCB->SetCurSel(n)==CB_ERR) AfxMessageBox("ќшибка в определении методов");
EnableButtomCur();
EnableButtomAll();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例7: UpdateTabs
// generates the string list of view names to be used for the tabs
void CBonfireDoc::UpdateTabs(LPCTSTR lpszPathName /*= NULL*/)
{
CStringList pTabList;
CString ext = (lpszPathName == NULL)
? GetFileExtension(GetPathName())
: GetFileExtension(lpszPathName);
// generate tabs based on the file extension
CString strViews = theApp.m_opOptions.views.vAssociations[0].strViews; // init to default views
CString strExtList = "";
size_t nExt = theApp.m_opOptions.views.vAssociations.size();
// see if the current file's extension is in the list
while (nExt-- > 0) // 0 is the default file extension
{
strExtList = (CString)theApp.m_opOptions.views.vAssociations[nExt].strExtensions;
strExtList.Remove(' ');
if (IsStringPresent(strExtList, ext))
{
strViews = theApp.m_opOptions.views.vAssociations[nExt].strViews;
break;
}
}
POSITION pos = GetFirstViewPosition();
CChildFrame* pChild = ((CChildFrame*)GetNextView(pos)->GetParentFrame());
CView* pView = pChild->GetActiveView();
BOOL bIsCurViewAvail = FALSE;
// also make sure the current view is available, if not, close it
// add the tabs to the tablist
for (int i = 0; i < theApp.m_arAllViews.GetSize(); i++)
{
if (strViews[i] != '-')
{
pTabList.AddHead( ((CBonfireView*)theApp.m_arAllViews[i])->m_strCaption );
if (pView && pView->IsKindOf(theApp.m_arAllViews[i]->m_pClass))
bIsCurViewAvail = TRUE;
}
}
// draw the tabs
pChild->DrawTabs(&pTabList);
if (!pView || !bIsCurViewAvail)
SwitchToFirstView();
}
示例8: MakeStringListByChar
bool MakeStringListByChar(CStringList& pList, const char * pInput )
{
const char * p;
int nSize;
p=pInput;
while(*p!='\0')
{
nSize = static_cast<int>(strlen(p));
if( nSize>0 )
{
pList.AddHead(p);
// printf(p);
}
p=p+nSize+1;
}
return true;
}
示例9: GetUndoActions
void CSynBCGPEditView::GetUndoActions( CStringList& lstActions ) const
{
CDWordArray dwaUAT;
m_pEdit->GetUndoActions(dwaUAT);
lstActions.RemoveAll();
int nIndex = (int)dwaUAT.GetSize();
if ( nIndex != 0)
{
CString strAction;
while (nIndex--)
{
strAction.Empty();
switch (dwaUAT.GetAt(nIndex) & UAT_REASON)
{
case g_dwUATUndefined:
strAction.LoadString(IDS_STRING_UAT_UNDEF);
break;
case g_dwUATTyping:
strAction.LoadString(IDS_STRING_UAT_TYPE);
break;
case g_dwUATCut:
strAction.LoadString(IDS_STRING_UAT_CUT);
break;
case g_dwUATPaste:
strAction.LoadString(IDS_STRING_UAT_PASTE);
break;
case g_dwUATDelete:
strAction.LoadString(IDS_STRING_UAT_DEL);
break;
case g_dwUATBackspace:
strAction.LoadString(IDS_STRING_UAT_BACK);
break;
case g_dwUATDragDrop:
strAction.LoadString(IDS_STRING_UAT_DRAG);
break;
case g_dwUATEnter:
strAction.LoadString(IDS_STRING_UAT_ENTER);
break;
case g_dwUATIndent:
strAction.LoadString(IDS_STRING_UAT_INDENT);
break;
case g_dwUATUnindent:
strAction.LoadString(IDS_STRING_UAT_UNINDENT);
break;
case g_dwUATTab:
strAction.LoadString(IDS_STRING_UAT_TAB);
break;
case g_dwUATReplace:
strAction.LoadString(IDS_STRING_UAT_REP);
break;
case g_dwUATComment:
strAction.LoadString(IDS_STRING_UAT_COMM);
break;
case g_dwUATUncomment:
strAction.LoadString(IDS_STRING_UAT_UNCOMM);
break;
case g_dwUATFormatter:
strAction.LoadString(IDS_STRING_UAT_TIDY);
break;
default:
strAction.LoadString(IDS_STRING_UAT_UNDEF);
}
if (strAction.IsEmpty())
{
ASSERT(FALSE);
strAction = _T("<?>");
}
lstActions.AddHead(strAction);
}
}
}
示例10: Search
void CHomeSearchCtrl::Search(bool bAutostart)
{
CString strText, strURI, strEntry, strClear;
m_wndText.GetWindowText( strText );
strText.TrimLeft();
strText.TrimRight();
LoadString( strClear, IDS_SEARCH_PAD_CLEAR_HISTORY );
if ( _tcscmp ( strClear , strText ) == 0 ) return;
// Check if user mistakenly pasted download link to search input box
if (theApp.OpenURL( strText, TRUE, TRUE ) )
{
m_wndText.SetWindowText( _T("") );
return;
}
CSchemaPtr pSchema = m_wndSchema.GetSelected();
if ( pSchema != NULL ) strURI = pSchema->GetURI();
Settings.Search.LastSchemaURI = strURI;
CQuerySearchPtr pSearch = new CQuerySearch();
pSearch->m_bAutostart = bAutostart;
pSearch->m_sSearch = strText;
pSearch->m_pSchema = pSchema;
BOOL bValid = pSearch->CheckValid( false );
if ( ! bValid && bAutostart )
{
// Invalid search, open help window
CQuerySearch::SearchHelp();
}
else if ( AdultFilter.IsSearchFiltered( pSearch->m_sSearch ) && bAutostart )
{
// Adult search blocked, open help window
CHelpDlg::Show( _T("SearchHelp.AdultSearch") );
}
else
{
if ( bValid )
{
// Load all
CStringList oList;
for ( int i = 0; ; i++ )
{
strEntry.Format( _T("Search.%.2i"), i + 1 );
CString strValue( theApp.GetProfileString( _T("Search"), strEntry ) );
if ( strValue.IsEmpty() )
break;
int lf = strValue.Find( _T('\n') );
if ( strText.CompareNoCase( ( lf != -1 ) ? strValue.Left( lf ) : strValue ) )
oList.AddTail( strValue );
}
// Cut to 200 items
while ( oList.GetCount() >= 200 )
oList.RemoveTail();
// New one (at top)
oList.AddHead( strURI.IsEmpty() ? strText : ( strText + _T('\n') + strURI ) );
// Save list
POSITION pos = oList.GetHeadPosition();
for ( int i = 0; pos; ++i )
{
strEntry.Format( _T("Search.%.2i"), i + 1 );
theApp.WriteProfileString( _T("Search"), strEntry, oList.GetNext( pos ) );
}
FillHistory();
}
new CSearchWnd( pSearch );
}
m_wndText.SetWindowText( _T("") );
}
示例11: OnInitDialog
BOOL CDlxiaoDllDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_button_stop.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_STOP)));
m_button_start.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_START)));
m_static_set.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_SZ)));
m_button_run.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_PL)));
PID = GetCurrentProcess();
Initialization();
readJn();
/* if(pickItemNameList.GetCount() == 0){
char pBuf[MAX_PATH];//存放路径的变量
//::GetCurrentDirectory(MAX_PATH,pBuf); //获取程序的当前目录
//strcat(pBuf,"\\");
//strcat(pBuf,"pickItem.txt");
HMODULE hmode = GetModuleHandle("dlxiaodll.dll");
GetModuleFileName(hmode,pBuf,MAX_PATH);
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
_splitpath(pBuf, drive, dir, NULL,NULL);
CString strPath;
strPath.Format("%s%s", drive, dir);
strPath += "pickItem.txt";
OutputDebugString(strPath);
CStdioFile file;
CString strLine;
if( file.Open(strPath,CFile.modeRead)){
while(file.ReadString(strLine)){
OutputDebugString(strLine);
pickItemNameList.AddHead(strLine);
}
file.Close();
}
}*/
pickItemNameList.AddHead("炼器符");
pickItemNameList.AddHead("粗木");
pickItemNameList.AddHead("碎石");
pickItemNameList.AddHead("香草");
pickItemNameList.AddHead("青田石");
pickItemNameList.AddHead("丹木");
pickItemNameList.AddHead("坚石矿");
pickItemNameList.AddHead("芒草");
pickItemNameList.AddHead("水碧");
pickItemNameList.AddHead("刚木");
pickItemNameList.AddHead("铁矿石");
pickItemNameList.AddHead("蛇衔草");
pickItemNameList.AddHead("水玉");
pickItemNameList.AddHead("甘华木");
pickItemNameList.AddHead("铜矿石");
pickItemNameList.AddHead("洞冥草");
pickItemNameList.AddHead("青碧");
pickItemNameList.AddHead("指星木");
pickItemNameList.AddHead("怀梦草");
pickItemNameList.AddHead("瑰玉");
pickItemNameList.AddHead("银矿石");
pickItemNameList.AddHead("灵寿木");
pickItemNameList.AddHead("金矿石");
pickItemNameList.AddHead("不死草");
pickItemNameList.AddHead("璇玉");
pickItemNameList.AddHead("天婴木");
pickItemNameList.AddHead("赤银矿石");
pickItemNameList.AddHead("龙须草");
pickItemNameList.AddHead("龙公木");
pickItemNameList.AddHead("乌金矿石");
pickItemNameList.AddHead("车马芝");
pickItemNameList.AddHead("仓玉");
pickItemNameList.AddHead("扶桑之木");
pickItemNameList.AddHead("玄铁矿石");
pickItemNameList.AddHead("九穗禾");
pickItemNameList.AddHead("天瑜");
pickItemNameList.AddHead("嘉禾之木");
pickItemNameList.AddHead("五色珍铁");
pickItemNameList.AddHead("天宫莲");
pickItemNameList.AddHead("帝玉");
return TRUE;
}