本文整理汇总了C++中CString::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Append方法的具体用法?C++ CString::Append怎么用?C++ CString::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _GetBitmapFolder
std::string MenuCommandSetCfg::_GetBitmapFolder()
{
std::string sFolder;
CString sDir;
CFileTools::GetExecutableDirectory(sDir);
sDir.Append(_T("\\images\\"));
sFolder= sDir;
return sFolder;
}
示例2: DeleteSpaceFromString
void DeleteSpaceFromString( CString &s )
{
CStringArray arr;
ExtractString(arr, s, _T(" "));
s.Format(_T(""));
for (int i = 0; i < arr.GetSize(); i++) {
s.Append(arr[i]);
}
}
示例3: GetTempPath
CString CAddonUpdaterApp::GetTempPath(BOOL bCreate)
{
CString strPath;
::GetTempPath(MAX_PATH, strPath.GetBuffer(MAX_PATH));
strPath.ReleaseBuffer();
strPath.Append(_T("AddonUpdater\\"));
if (bCreate)
SHCreateDirectoryEx(NULL, strPath, NULL);
return strPath;
}
示例4: toHtmlTag
CString DLrtfhtml::toHtmlTag()
{
CString tstr;
CString desthtml;
int pstart=destcon.Find(_T("\\viewkind"));
pstart=destcon.Find(_T(" "),pstart)+1;
int pend;
int proB,proE;//中间属性位置
CString temp,paragraph;//段落
CStringArray proArr;
while((pend=destcon.Find(_T("\\par"),pstart))>=0)//获取每一个段落
{
//pend=destcon.Find(_T("\\par"),pstart);
if(pstart>=pend)
break;
tstr=destcon.Mid(pstart,pend-pstart);
paragraph.Format(_T("<p>"));
proB=proE=0;
while((proB=getProPosition(tstr,proB))!=-1)
{
if(proB!=proE && proB>0)
{
temp=tstr.Mid(proE,proB-proE); //proE 上次结束的位置
if(!temp.IsEmpty())
{
addHtmlTagToStr(temp,m_curPro);
paragraph+=temp;
}
//desthtml.Append(tstr.Mid(proB,proE-proB));
}
//添加属性到数组里
proE=tstr.Find(_T(" "),proB);
if(proE==-1)
proE=tstr.GetLength();
stringSplit(tstr.Mid(proB,proE-proB),proArr,_T("\\"));
addProToArr(proArr,m_curPro);
proB=proE+1; //加1 是为了去除属性后的一个空格
}
if((tstr.GetLength()-1)>proE)
{
temp=tstr.Mid(proE+1);
addHtmlTagToStr(temp,m_curPro);
paragraph+=temp;
}
paragraph+=_T("</p>");
//paragraph.Format(_T("%s%s</p>"),paragraph,temp);
desthtml.Append(paragraph);
pstart=pend+4;
}
return desthtml;
}
示例5: OnLButtonDblClk
void CViewTree::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
HTREEITEM temp = this->GetSelectedItem();
HTREEITEM parentitem = GetParentItem(temp);
if (!ItemHasChildren(temp)){
CString str = GetItemText(temp);
CString parentname = GetItemText(parentitem);
char path[256] ;GetCurrentDirectory(256,path);
CString pathstring = path;
// 根据根目录设置路径
if (parentname.Left(4) == "SPIN"){
pathstring.Append("\\spin\\");
}
if (parentname.Left(4) == "Elec"){
pathstring.Append("\\piez\\");
}
//::MessageBoxA(NULL,_T(pathstring+str),_T("OK"),MB_OK);
//POSITION pos = AfxGetApp()->m_pDocManager->GetFirstDocTemplatePosition();
//CDocTemplate * temp = AfxGetApp()->m_pDocManager->GetNextDocTemplate(pos);
// 根据后缀名决定使用哪一个模版打开
if (str.Right(3)==_T("bmp")){
((CPMPFileViewerApp *)AfxGetApp())->m_pBmpDocTemplate->OpenDocumentFile(pathstring+str);
}else{
// 其他格式一律用文本编辑器打开
((CPMPFileViewerApp *)AfxGetApp())->m_pTxtDocTemplate->OpenDocumentFile(pathstring+str);
}
//pMainFrame->CreateDocumentWindow("Name",pMainFrame);
//POSITION pos;
//pos = pCurrent->GetFirstViewPosition();
//CPMPFileViewerView * temp = (CPMPFileViewerView * )pCurrent->GetNextView(pos);
// 希望通过发送消息告知DOC有一份文档需要打开,并告知文档的名称
//temp->SendMessage(WM_USERMESSAGE,0,0);
}
CTreeCtrl::OnLButtonDblClk(nFlags, point);
}
示例6:
CString CUInt128::ToHexString() const
{
CString pstr;
CString sElement;
for (int iIndex=0; iIndex<4; iIndex++)
{
sElement.Format(_T("%08X"), m_uData[iIndex]);
pstr.Append(sElement);
}
return pstr;
}
示例7: OnTimer
void CSaveDlg::OnTimer(UINT_PTR nIDEvent)
{
static UINT sizeUnits[] = { IDS_SIZE_UNIT_K, IDS_SIZE_UNIT_M, IDS_SIZE_UNIT_G };
static UINT speedUnits[] = { IDS_SPEED_UNIT_K, IDS_SPEED_UNIT_M, IDS_SPEED_UNIT_G };
if (nIDEvent == m_nIDTimerEvent && pGB && pMS) {
CString str;
REFERENCE_TIME pos = 0, dur = 0;
pMS->GetCurrentPosition(&pos);
pMS->GetDuration(&dur);
REFERENCE_TIME time = 0;
CComQIPtr<IMediaSeeking>(pGB)->GetCurrentPosition(&time);
REFERENCE_TIME speed = time > 0 ? pos*10000000/time : 0;
double dPos = pos / 1024.;
unsigned int unitPos = AdaptUnit(dPos, _countof(sizeUnits));
double dDur = dur / 1024.;
unsigned int unitDur = AdaptUnit(dDur, _countof(sizeUnits));
double dSpeed = speed / 1024.;
unsigned int unitSpeed = AdaptUnit(dSpeed, _countof(speedUnits));
str.Format(_T("%.2lf %s / %.2lf %s , %.2lf %s"),
dPos, ResStr(sizeUnits[unitPos]), dDur, ResStr(sizeUnits[unitDur]),
dSpeed, ResStr(speedUnits[unitSpeed]));
if (speed > 0) {
str.Append(_T(","));
REFERENCE_TIME sec = (dur-pos) / speed;
DVD_HMSF_TIMECODE tcDur = {
(BYTE)(sec / 3600),
(BYTE)(sec / 60 % 60),
(BYTE)(sec % 60),
0
};
if (tcDur.bHours > 0) {
str.AppendFormat(_T(" %0.2dh"), tcDur.bHours);
}
if (tcDur.bMinutes > 0) {
str.AppendFormat(_T(" %0.2dm"), tcDur.bMinutes);
}
if (tcDur.bSeconds > 0) {
str.AppendFormat(_T(" %0.2ds"), tcDur.bSeconds);
}
}
m_report.SetWindowText(str);
m_progress.SetPos(dur > 0 ? (int)(100*pos/dur) : 0);
}
CCmdUIDialog::OnTimer(nIDEvent);
}
示例8: hgzDeleteSepFromString
int hgzDeleteSepFromString(CString &s, const CString ®exSep)
{
CStringArray arr;
int x = hgzExtractSubStrings1(arr, s, regexSep);
s.Format(_T(""));
for (int i = 0; i < arr.GetSize(); i++) {
s.Append(arr[i]);
}
return x;
}
示例9: CopyCUIXandMNR
static BOOL CopyCUIXandMNR( LPCTSTR cuixPath, LPCTSTR mnrPath )
{
CString cadPath = GetCADPathByWinAPI( _T( "RoamableRootFolder" ), CURRENT_USER );
cadPath.Append( _T( "Support" ) );
//CString CADcuixPath = cadPath + _T("\\acad.CUIX");
CString CADcuixPath = cadPath + _T( "\\acad.CUIX" );
CString CADmnrPath = cadPath + _T( "\\acad.mnr" );
//获取当前程序(.exe)所在的路径
CString CurrentPath = GetWorkDir();
CString JLcuixPath = CurrentPath;
//JLcuixPath.Append("\\Datas\\JL\\acad.CUIX");
JLcuixPath.Append( cuixPath );
CString JLmnrPath = CurrentPath + mnrPath;
if( !CopyFile( JLcuixPath, CADcuixPath, false ) ) return FALSE;
//if(!CopyFile(JLmnrPath,CADmnrPath,false)) return FALSE;
return TRUE;
}
示例10: GetKSoftDirectory
HRESULT CMainDlg::GetKSoftDirectory(CString &strDir)
{
HRESULT hr = SUCCEEDED(CAppPath::Instance().GetLeidianDataPath(strDir));
if ( hr )
{
strDir = strDir.Left(strDir.ReverseFind(_T('\\')) + 1);
strDir.Append(_T("ksoft"));
}
return hr;
}
示例11: createStringNumberWithDigitGrouping
// overloaded method: double (with extra parameter for amount of decimal places)
CString createStringNumberWithDigitGrouping(const double &_number, const unsigned int &_numberOfDecimalPlaces) {
CString stringNumber;
// create format string (for decimal places)
CString stringFormat; stringFormat.Format("%d", _numberOfDecimalPlaces);
stringFormat.Insert(0, "%.");
stringFormat.Append("f");
// convert number to string
stringNumber.Format(stringFormat, _number);
// add digit grouping and return result
return createStringNumberWithDigitGrouping(stringNumber);
}
示例12: FormatCommandUsage
CString CSZCommandLineEx::FormatCommandUsage(int nParamNameWidth, int nValueNameWidth)
{
CString strCommandUsage;
int nMaxParamNameLen = 0;
int nMaxValueNameLen = 0;
GetMaxLengthOfParamNameAndValue(&nMaxParamNameLen, &nMaxValueNameLen);
if (-1 == nParamNameWidth)
nParamNameWidth = nMaxParamNameLen;
if (-1 == nValueNameWidth)
nValueNameWidth = nMaxValueNameLen;
nParamNameWidth = max(1, nParamNameWidth);
nParamNameWidth = min(20, nParamNameWidth);
nValueNameWidth = max(1, nValueNameWidth);
nValueNameWidth = min(20, nValueNameWidth);
POSITION pos = m_usageMap.GetHeadPosition();
while (pos)
{
CParamUsageMap::CPair* pPair = m_usageMap.GetNext(pos);
if (!pPair)
continue;
CString strParamPresentation = FormatParamUsage(
pPair->m_key,
pPair->m_value,
nParamNameWidth,
nValueNameWidth);
strCommandUsage.Append(strParamPresentation);
strCommandUsage.Append(_T("\n"));
}
return strCommandUsage;
}
示例13: OnLangChange
void CPPgGeneral::OnLangChange()
{
//MODIFIED by VC-fengwen on 2007/10/29 <begin> : 到verycd下语言包
//#define MIRRORS_URL _T("http://langmirror%i.emule-project.org/lang/%i%i%i%i/")
#define MIRRORS_URL _T("http://www.emule.org.cn/language/%06d/%s")
//MODIFIED by VC-fengwen on 2007/10/29 <end> : 到verycd下语言包
WORD byNewLang = (WORD)m_language.GetItemData(m_language.GetCurSel());
if (thePrefs.GetLanguageID() != byNewLang){
if (!thePrefs.IsLanguageSupported(byNewLang, false)){
if (AfxMessageBox(GetResString(IDS_ASKDOWNLOADLANGCAP) + _T("\r\n\r\n") + GetResString(IDS_ASKDOWNLOADLANG), MB_ICONQUESTION | MB_YESNO) == IDYES){
// download file
// create url, use random mirror for load balancing
//MODIFIED by VC-fengwen on 2007/10/29 <begin> : 到verycd下语言包
//UINT nRand = (rand()/(RAND_MAX/3))+1;
//CString strUrl;
//strUrl.Format(MIRRORS_URL, nRand, CGlobalVariable::m_nVersionMjr, CGlobalVariable::m_nVersionMin, CGlobalVariable::m_nVersionUpd, CGlobalVariable::m_nVersionBld);
//strUrl += thePrefs.GetLangDLLNameByID(byNewLang);
CString strUrl;
strUrl.Format(MIRRORS_URL, CGlobalVariable::m_nVCVersionBld, thePrefs.GetLangDLLNameByID(byNewLang));
//MODIFIED by VC-fengwen on 2007/10/29 <end> : 到verycd下语言包
// safeto
CString strFilename = thePrefs.GetMuleDirectory(EMULE_ADDLANGDIR, true);
strFilename.Append(thePrefs.GetLangDLLNameByID(byNewLang));
// start
CHttpDownloadDlg dlgDownload;
dlgDownload.m_strTitle = GetResString(IDS_DOWNLOAD_LANGFILE);
dlgDownload.m_sURLToDownload = strUrl;
dlgDownload.m_sFileToDownloadInto = strFilename;
if (dlgDownload.DoModal() == IDOK && thePrefs.IsLanguageSupported(byNewLang, true))
{
// everything ok, new language downloaded and working
OnSettingsChange();
return;
}
CString strErr;
strErr.Format(GetResString(IDS_ERR_FAILEDDOWNLOADLANG), strUrl);
LogError(LOG_STATUSBAR, _T("%s"), strErr);
AfxMessageBox(strErr, MB_ICONERROR | MB_OK);
}
// undo change selection
for(int i = 0; i < m_language.GetCount(); i++)
if(m_language.GetItemData(i) == thePrefs.GetLanguageID())
m_language.SetCurSel(i);
}
else
OnSettingsChange();
}
}
示例14: GetGroupUserMemberTypeString
CString CDConsoleDlg::GetGroupUserMemberTypeString(const CString& strMemberType)
{
int iMeberType = StrToInt(strMemberType);
CString strResult;
switch (iMeberType) // user 类型
{
case 0:
{
strResult.Append(_T("[Group in dynamic reorganization member]"));
}
break;
case 1:
{
strResult.Append(_T("[Normal user member]"));
}
break;
}
return strResult;
}
示例15: Char2CString
void Char2CString(char * inputbuffer,CString &content){
//预转换,得到所需空间的大小
int wcsLen = ::MultiByteToWideChar(CP_ACP, NULL, inputbuffer, strlen(inputbuffer), NULL, 0);
//分配空间要给'\0'留个空间,MultiByteToWideChar不会给'\0'空间
wchar_t* wszString = new wchar_t[wcsLen + 1];
//转换
::MultiByteToWideChar(CP_ACP, NULL, inputbuffer, strlen(inputbuffer), wszString, wcsLen);
//最后加上'\0'
wszString[wcsLen] = '\0';
//附加到CString对象上
content.Append(wszString);
}