本文整理汇总了C++中CStrList类的典型用法代码示例。如果您正苦于以下问题:C++ CStrList类的具体用法?C++ CStrList怎么用?C++ CStrList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStrList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileDialog
void CLoadSavePropPage::OnBnClickedButtonSave()
{
const int MAX_BUFFER_SIZE = 1024;
CFileDialog FileDialog(FALSE);
CString strBuffer;
FileDialog.GetOFN().lpstrFile = strBuffer.GetBuffer(MAX_BUFFER_SIZE);
FileDialog.GetOFN().nMaxFile = MAX_BUFFER_SIZE;
FileDialog.GetOFN().lpstrDefExt = TEXT(".txt");
FileDialog.GetOFN().lpstrFilter = TEXT("Text Files(*.txt)\0*.txt\0All Files(*.*)\0*.*\0\0");
INT_PTR nRet = FileDialog.DoModal();
strBuffer.ReleaseBuffer();
if (nRet == IDOK)
{
CString strFileName = FileDialog.GetPathName();
CString strText;
m_TextEdit.GetWindowText(strText);
CStrList StrList;
StrList.SetText(strText);
StrList.SaveToFile(strFileName, false);
}
}
示例2: OnBnClickedButtonSetCommatext
void CCommaTextPropPage::OnBnClickedButtonSetCommatext()
{
CStrList StrList;
CString strCommaText;
m_CommaTextEdit.GetWindowText(strCommaText);
StrList.SetCommaText(strCommaText);
m_Edit2.SetWindowText(StrList.GetText());
}
示例3: OnInitDialog
BOOL CIndexOfPropPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// Init the text of m_TextEdit
CStrList StrList;
StrList.Add(TEXT("abc"));
StrList.Add(TEXT("123,4"));
StrList.Add(TEXT("x y z"));
StrList.Add(TEXT("a=b"));
StrList.Add(TEXT("a=c"));
StrList.Add(TEXT("b=test1"));
StrList.Add(TEXT("str = test2"));
StrList.Add(TEXT("str=test2"));
StrList.Add(TEXT("string=test3"));
m_TextEdit.SetWindowText(StrList.GetText());
// Init m_IndexOfParamEdit
m_IndexOfParamEdit.SetWindowText(TEXT("a=c"));
// Init m_IndexOfNameParamEdit
m_IndexOfNameParamEdit.SetWindowText(TEXT("str"));
return TRUE;
}
示例4: OnBnClickedButtonSort
void CSortPropPage::OnBnClickedButtonSort()
{
CString strText;
m_TextEdit.GetWindowText(strText);
CStrList StrList;
StrList.SetText(strText);
StrList.SetSorted(true);
m_TextEdit.SetWindowText(StrList.GetText());
}
示例5: OnBnClickedButtonIndexofname
void CIndexOfPropPage::OnBnClickedButtonIndexofname()
{
CString strText;
m_TextEdit.GetWindowText(strText);
CString strParam;
m_IndexOfNameParamEdit.GetWindowText(strParam);
CStrList StrList;
StrList.SetText(strText);
int nIndex = StrList.IndexOfName(strParam);
m_IndexOfNameResultEdit.SetWindowText(IntToStr(nIndex));
}
示例6: ShowComboCtrl
BOOL CInPlaceCombo::ShowComboCtrl(DWORD dwStyle, const CRect &rCellRect, CWnd* pParentWnd, UINT uiResourceID,
int iRowIndex, int iColumnIndex, CStrList &lstDropDown, CString strCurSel, int iCurSel )
{
m_iRowIndex = iRowIndex;
m_iColumnIndex = iColumnIndex;
m_bESC = FALSE;
m_DropDownList.clear();
m_DropDownList.insert(m_DropDownList.begin(), lstDropDown.begin(), lstDropDown.end());
BOOL bRetVal = TRUE;
if (-1 != iCurSel)
{
GetLBText(iCurSel, m_strWindowText);
}
else if (!strCurSel.IsEmpty())
{
m_strWindowText = strCurSel;
}
if (NULL == m_pInPlaceCombo->m_hWnd)
{
// ComboBoxLineToDisplay(&m_pInPlaceCombo,10);
bRetVal = m_pInPlaceCombo->Create(dwStyle, rCellRect, pParentWnd, uiResourceID);
//m_pInPlaceCombo->SetItemHeight(1,2);
m_pInPlaceCombo->EnableScrollBar(SB_BOTH,ESB_ENABLE_BOTH);
m_pInPlaceCombo->SetDroppedWidth(100);
}
if (iCurSel >=0 && iCurSel < this->GetCount())
{
SetCurSel(iCurSel);
}
else
{
SelectString(0, strCurSel);
}
return bRetVal;
}
示例7: get_current_zone
// ===========================================================
// searches for valid charging-period, if not found, the default-string is returned
void get_current_zone(char *timeperiods)
// ===========================================================
{
CString str;
CString tmp;
size_t matchlen=0;
*timeperiods=0;
for (int t=0;t<costuserlist.GetCount();t++)
{
str=costuserlist.GetString(t);
get_token(str,USERPHON,tmp);
if (!timeperiods[0] && (!stricmp(tmp,"default") || !stricmp(tmp,"по умолчанию")))
{
get_token(str,USERZONE,tmp);
strcpy(chargzone,tmp);
get_period_by_zone(chargzone,tmp);
strcpy(timeperiods,tmp); // defaultvalue found
}
else if (!strncmp(curphone,tmp,strlen(tmp)) && strlen(tmp)>matchlen)
// search maximum similarity to curphone in costuser
{
matchlen = strlen(tmp);
get_token(str,USERZONE,tmp);
strcpy(chargzone,tmp);
get_period_by_zone(chargzone,tmp);
strcpy(timeperiods,tmp);
}
}
}
示例8: OnOK
// =====================================================================
void insmm::OnOK()
// =====================================================================
{
int sel;
CString line;
CString mmfile;
char buf[300];
char *p;
UpdateData(1);
sel=m_mm_list.GetCurSel();
if (sel==LB_ERR)
ERR_MSG_RET("E_PLSAME");
line=mmstuff.GetString(sel);
get_token(line,0,mmfile);
strcpy(buf,mmfile);
p=strchr(buf,'.');
if (!p)
ERR_MSG_RET("E_ILLMML");
*p=0;
p=buf;
// while (*p && *p=='0') // skip begining zeroes
// p++;
MM_Element.Format("%s%s%d%s",MM_PREFIX,m_mmtype==0 ? "B":"W",IDTOCOD(m_mmdisplay),p);
infolist.RemoveAll();
CDialog::OnOK();
}
示例9: OnOK
// ================================================
void resultfm::OnOK()
// ================================================
{
char buf[1000];
char tabs[1000];
int i;
if (!TestConsistency())
return;
m_edit_format.GetWindowText(buf,999);
for (i=0;i<(int)strlen(buf);i++)
if (!strchr(" ASETIDKXY",buf[i]))
ERR_MSG2_RET("E_ILLRCCIS",buf[i]);
m_edit_tabs.GetWindowText(tabs,999);
for (i=0;i<(int)strlen(tabs);i++)
if (tabs[i]!=',' && !isdigit(tabs[i]))
ERR_MSG2_RET("E_ILLRSCCIS",tabs[i]);
resultdisp.RemoveAll();
resultdisp.AddTail(buf);
resultdisp.AddTail(tabs);
resultdisp.SaveToFile("resudisp.cfg");
KillTimer(2345);
CDialog::OnOK();
}
示例10: get_period_by_zone
// ===========================================================
// searches the time-period by the specified zone, returns string "UNIT CHARGESTRING"
void get_period_by_zone(const char *zone,CString &period)
// ===========================================================
{
CString str,tmp;
struct tm *loctime;
time_t tim;
period.Empty();
for (int t=0;t<costbaselist.GetCount();t++)
{
str=costbaselist.GetString(t);
get_token(str,BASEZONE,tmp);
if (!tmp.CompareNoCase(zone))
{
time(&tim); /* Get time as long integer. */
loctime = localtime(&tim); /* Convert to local time. */
if (loctime->tm_wday == 0 || loctime->tm_wday == 6)
get_token(str,BASEWEND,period); // weekend
else
get_token(str,BASEWDAY,period); // workdays
get_token(str,BASECURR,tmp); // currency
strcpy(currency,tmp);
get_token(str,BASEPERU,tmp); // charging per unit
period = tmp+" "+period;
return;
}
}
}
示例11: OnInitDialog
// ===========================================================================
BOOL receiver::OnInitDialog()
// ===========================================================================
{
CString str;
int tabs[]={60,170};
int tabs2[]={100};
int lng[]={
IDC_ADD1,
IDC_ADD2,
IDC_CHANGE1,
IDC_CHANGE2,
IDC_DELETE1,
IDC_DELETE2,
IDC_STATIC1,
IDC_STATIC2,
IDC_STATIC4,
IDC_STATIC3,
IDC_STATIC5,
IDC_IMPORT,
};
CDialog::OnInitDialog();
set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int));
TAB_LIST(m_groups,tabs2);
TAB_LIST(m_members,tabs);
for (int i=0;i<Agroups.GetCount();i++)
{
str=Agroups.GetString(i);
str.Trim();
m_groups.AddString(str);
}
SET_SEL(m_groups,0);
OnLbnSelchangeGroups();
return TRUE;
}
示例12: OnDefault
// ================================================
void resultfm::OnDefault()
// ================================================
{
m_edit_format.SetWindowText("ATSTI");
m_edit_tabs.SetWindowText("72,154");
resultdisp.RemoveAll();
resultdisp.AddTail("ATSTI");
resultdisp.AddTail("72,154");
resultdisp.SaveToFile("resudisp.cfg");
}
示例13: populate_lists
// ===========================================================================
void receiver::populate_lists()
// ===========================================================================
{
CString help,group;
int i;
m_groups.ResetContent();
m_members.ResetContent();
for (i=0;i<Agroups.GetCount();i++)
{
help=Agroups.GetString(i);
get_token(help,0,group);
m_groups.AddString(group);
}
}
示例14: OnOK
// ===========================================================================
void receiver::OnOK()
// ===========================================================================
{
Agroups.SaveToFile("receiver.cfg");
if(m_bCloseOnOk)
CDialog::OnOK();
}
示例15: OnCancel
// ================================================
void resultfm::OnCancel()
// ================================================
{
resultdisp.LoadFromFile("resudisp.cfg");
KillTimer(2345);
CDialog::OnCancel();
}