本文整理汇总了C++中CString::SetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::SetAt方法的具体用法?C++ CString::SetAt怎么用?C++ CString::SetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::SetAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFtp
int CProtocolInfo::GetFtp(SESSION *session, TCHAR *pBuf, int nBufLenth)
{
if(nBufLenth < 5 || pBuf[0] < 'A' || pBuf[0] > 'z')
return XERR_SUCCESS;
TCHAR tBuf[MAX_PATH];
CString tmpStr;
if(_tcsnicmp(pBuf, _T("RETR "), 5) == 0)
{
_stscanf(pBuf + 4, _T("%*[ ]%s"), tBuf);
tmpStr.Format(_T("Get File: %s"), tBuf);
if(tmpStr.GetLength() >= MAX_PATH - 1)
tmpStr.SetAt(MAX_PATH - 1, '\0');
_tcscpy(session->sMemo, tmpStr);
m_CheckAcl.GetSession()->SendSessionToAppEx(session);
}
else if(_tcsnicmp(pBuf, _T("STOR "), 5) == 0)
{
_stscanf(pBuf + 4, _T("%*[ ]%s"), tBuf);
tmpStr.Format(_T("Put File: %s"), tBuf);
if(tmpStr.GetLength() >= MAX_PATH - 1)
tmpStr.SetAt(MAX_PATH - 1, '\0');
_tcscpy(session->sMemo, tmpStr);
m_CheckAcl.GetSession()->SendSessionToAppEx(session);
}
return XERR_SUCCESS;
}
示例2: Say
void CWndDialog::Say( LPCTSTR lpszString, DWORD dwQuest )
{
QuestProp* pQuestProp = prj.m_aPropQuest.GetAt( dwQuest );
CString string = " ";
if( dwQuest )
{
string = "#b#cff5050f0";
string += pQuestProp->m_szTitle;
string += "#nb#nc\n";
string += " ";
string += lpszString;
}
else
string += lpszString;
int nLength = string.GetLength();//_tcslen( szString );
int i,j; for( i = 0, j = 0; i < nLength; i++ )
{
if( string[ i ] == '\\' && string[ i + 1 ] == 'n' )
{
// 중간의 두개의 코드를 \n와 ' '로 대체.
string.SetAt( i, '\n' );
string.SetAt( i + 1, ' ' );
// 그리고 스페이스 한개 삽입.
string.Insert( i + 1, " " );
}
}
m_dwQuest = dwQuest;
ParsingString( string );
EndSay();
}
示例3: ProcStringBlank
void CArrayMatrix::ProcStringBlank(CString & sHead)
{
int len=lstrlen(sHead);
if(len==0) return;
CString m_temp=sHead;
sHead.GetBufferSetLength(len+1);
int j=0;
for(int i=0;i<len;i++)
{
if(m_temp[i]==TCHAR(' '))
{
if((i+1)!=len&&m_temp[i+1]==TCHAR(' ')) continue;
else
{
sHead.SetAt(j,sHead[i]);
j++;
}
}
else {sHead.SetAt(j,m_temp[i]);j++;}
}
sHead.SetAt(j,TCHAR('\0'));
j=lstrlen(sHead);
sHead.GetBufferSetLength(j);
sHead.Replace(" \n","\n");
sHead.Replace("\n ","\n");
}
示例4: ValidateString
void CXmlItem::ValidateString(CString& sText, TCHAR cReplace)
{
// remove nasties that XML does not like
int nLen = sText.GetLength();
for(int nChar = 0; nChar < nLen; nChar++)
{
TCHAR c = sText[nChar];
switch (c)
{
case 0x2026: // ellipsis
sText.SetAt(nChar, cReplace);
break;
}
// default handling
// from http://support.microsoft.com/kb/315580
BOOL bValid = ((c >= 0xE000 && c <= 0xFFFD) ||
(c > 0x009F && c <= 0xD7FF) ||
(c >= 0x0020 && c < 0x0082) ||
(c == 0x09 || c == 0x0A || c == 0x0D));
if (!bValid)
{
TRACE (_T("CXmlItem::ValidateString(replacing 0x%08X with 0x%08X)\n"), c, cReplace);
sText.SetAt(nChar, cReplace);
}
}
}
示例5: TurnString
void CMatrixDoc::TurnString(CString &sdata)
{
CString * pVal=NULL;
int num=GetVariableNum(sdata,pVal);
int debug=num;
for(int i=0;i<num;i++)
{
sdata.Replace(pVal[i],"@");
}
CString temp=sdata;
num=0;
for(int j=0;j<lstrlen(temp);j++)
{
if(temp[j]!=TCHAR(' '))
{
sdata.SetAt(num,temp[j]);
num++;
}
else continue;
}
if(num<lstrlen(temp))
{
sdata.SetAt(num,'\0');
sdata.GetBufferSetLength(lstrlen(sdata));
}
if(pVal!=NULL) delete []pVal;
}
示例6:
bool CSecretDrv2::CreateImpowerID(CString serialID, CString machineID, CString& impowerOut)
{
ASSERT(serialID.GetLength ()>=8);
ASSERT(machineID.GetLength ()>=8);
BYTE bIn[8];
BYTE bOut[8];
//
for(int i=0;i<4;i++)
{
char ch[3];
ch[0]=serialID.GetAt (i*2);
ch[1]=serialID.GetAt (i*2+1);
int n = From16ToInt(ch);
bIn[i]=(BYTE)n;
}
for(int i=0;i<4;i++)
{
char ch[5];
ch[0]=machineID.GetAt (i*2);
ch[1]=machineID.GetAt (i*2+1);
int n = From16ToInt(ch);
bIn[i+4]=(BYTE)n;
}
secret (bOut,bIn);
impowerOut="";
for(int i=0;i<4;i++)
{
int n = (int)bOut[i];
CString s;
s.Format ("%2x",n);
if(s[0]==' ')
s.SetAt (0,'0');
if(s[1]==' ')
s.SetAt (1,'0');
impowerOut+=s;
}
for(int i=0;i<4;i++)
{
int n = (int)bOut[i+4];
CString s;
s.Format ("%2x",n);
if(s[0]==' ')
s.SetAt (0,'0');
if(s[1]==' ')
s.SetAt (1,'0');
impowerOut+=s;
}
impowerOut=impowerOut.Left(8);
return true;
}
示例7: WinCharToAscii
void Utils::WinCharToAscii (CString& strComment)
{
for (int i = 0; i < strComment.GetLength(); i++)
{
BYTE ch = BYTE(strComment.GetAt(i));
switch (ch)
{
case ch_aa : ch = '}'; break;
case ch_ae : ch = '{'; break;
case ch_oe : ch = '|'; break;
case ch_AA : ch = ']'; break;
case ch_AE : ch = '['; break;
case ch_OE : ch = '\\'; break;
case 8 :
case 13 :
case 10 : break;
default:
if (ch < ' ' || ch > '~')
{
ch = ' ';
}
break;
}
strComment.SetAt(i, ch);
}
}
示例8: sizeof
BOOL RC4::Crypt(CString &data)
{
int a, b, nSize = data.GetLength();
TCHAR ch;
for(int i = 0; i < data.GetLength(); i++ )
{
x = ( x + 1 ) & 0xFF; a = m[x];
y = ( y + a ) & 0xFF;
m[x] = b = m[y];
m[y] = a;
ch = data[i];
ch ^= m[( a + b ) & 0xFF];
data.SetAt(i, ch);
}
// cover bin data to ASCII string
TCHAR *pASCII = new TCHAR [nSize * sizeof(TCHAR) * 2 + 1];
if (!pASCII)
return FALSE;
for (int l=0; l < nSize; l++)
wsprintf((TCHAR *)&(pASCII)[l*2], "%02X", data[l]);
data = pASCII;
delete pASCII;
return TRUE;
}
示例9: OnDblclickStackList
void CStackViewBar::OnDblclickStackList()
{
int nSel = m_List.GetCurSel();
if (nSel > -1)
{
int i = 0;
const char* pCur = &m_vecCallStack[0];
while ( i < nSel )
{
int Len = strlen(pCur);
if (Len == 0)
break;
pCur += Len + 1;
i++;
}
if (i == nSel)
{
CString PathFile = pCur;
int nPathEnd = PathFile.Find(',');
if (nPathEnd > 0)
{
PathFile.SetAt(nPathEnd, '\0');
int nLineNum = strtol(pCur + nPathEnd + 1, NULL, 10);
CDbgRemoteApp* pApp = (CDbgRemoteApp*)AfxGetApp();
pApp->DisplayFileLine(PathFile, nLineNum);
}
}
}
}
示例10: FixFilename
void FixFilename(CString& str)
{
str.Trim();
for (int i = 0, l = str.GetLength(); i < l; i++) {
switch (str[i]) {
case '?':
case '"':
case '/':
case '\\':
case '<':
case '>':
case '*':
case '|':
case ':':
str.SetAt(i, '_');
}
}
CString tmp;
// not support the following file names: "con", "con.txt" "con.name.txt". But supported "name.con" and "name.con.txt".
if (str.GetLength() == 3 || str.Find('.') == 3) {
tmp = str.Left(3).MakeUpper();
if (tmp == _T("CON") || tmp == _T("AUX") || tmp == _T("PRN") || tmp == _T("NUL")) {
str = _T("___") + str.Mid(3);
}
}
if (str.GetLength() == 4 || str.Find('.') == 4) {
tmp = str.Left(4).MakeUpper();
if (tmp == _T("COM1") || tmp == _T("COM2") || tmp == _T("COM3") || tmp == _T("COM4") ||
tmp == _T("LPT1") || tmp == _T("LPT2") || tmp == _T("LPT3")) {
str = _T("____") + str.Mid(4);
}
}
}
示例11: GetString
/// Funktion gibt einen String zurück, der in einer StringTable steht.
CString CLoc::GetString(const CString& key, BOOLEAN forceBigStarting, const CString& subString1, const CString& subString2)
{
CString returnString;
if (!m_StringTable.Lookup(key, returnString))
return key + " is missing";
// Haben wir subStrings übergeben, so müssen wir die § Zeichen ersetzen
if (subString1 != "")
{
// hier ein bisl umständlich, aber sonst würde er alle "§" Zeichen ersetzen
int pos = returnString.FindOneOf("§");
if (pos != -1)
{
returnString.Delete(pos);
returnString.Insert(pos,subString1);
if (subString2 != "")
returnString.Replace("§",subString2);
}
}
if (forceBigStarting)
{
CString upper = (CString)returnString.GetAt(0);
returnString.SetAt(0, upper.MakeUpper().GetAt(0));
}
return returnString;
}
示例12: MakePath
CString CUtils::MakePath(CString Path)
{
char drive[_MAX_DRIVE+1];
char path[_MAX_PATH+1];
int i;
CString result;
if(Path[Path.GetLength()-1] != '\\')
{
_splitpath(LPCSTR(Path), drive, path, NULL, NULL);
Path = CString(drive) + CString(path);
}
if(Path[Path.GetLength()-1] != '\\') Path += '\\';
for(i = 0; i<Path.GetLength(); i++)
if(Path[i] == '/') Path.SetAt(i, '\\');
for(i = 0; i<Path.GetLength(); i++)
if(i == 0 || Path[i] != '\\' || (Path[i] == '\\' && Path[i-1] != '\\')){
result += Path[i];
if(Path[i] == '\\'){
CreateDirectory(LPCSTR(result), NULL);
DWORD attr = GetFileAttributes(LPCSTR(result));
if(attr == 0xFFFFFFFF || (attr & FILE_ATTRIBUTE_DIRECTORY) == 0) return "";
}
}
return result;
}
示例13: DEncrypt
CString CAuthDlg::DEncrypt(CString str)
{
for(int i = 0; i < str.GetLength(); i++) {
str.SetAt(i, str[i]^5);
}
return str;
}
示例14: DrawAttribute
void CPropTreeItemEdit::DrawAttribute(CDC* pDC, const RECT& rc)
{
ASSERT(m_pProp!=NULL);
pDC->SelectObject(IsReadOnly() ? m_pProp->GetNormalFont() : m_pProp->GetBoldFont());
pDC->SetTextColor(RGB(0,0,0));
pDC->SetBkMode(TRANSPARENT);
CRect r = rc;
TCHAR ch;
// can't use GetPasswordChar(), because window may not be created yet
ch = (m_bPassword) ? '*' : '\0';
if (ch)
{
CString s;
s = m_sEdit;
for (LONG i=0; i<s.GetLength();i++)
s.SetAt(i, ch);
pDC->DrawText(s, r, DT_SINGLELINE|DT_VCENTER);
}
else
{
pDC->DrawText(m_sEdit, r, DT_SINGLELINE|DT_VCENTER);
}
}
示例15: OnChangeModparamsFileID
void CEventModParam::OnChangeModparamsFileID()
{
if (m_pPS) m_pPS->SetToClose(0);
CString cString;
m_EventModParamsFileID.GetWindowText(cString);
bool bDoSave = false;
//force upper
for (int i = 0; i < cString.GetLength(); i++)
{
if (islower(cString[i]))
bDoSave = true;
if (!isalnum(cString[i]))
{
cString.SetAt(i,'0');
bDoSave = true;
}
}
if (bDoSave)
{
cString.MakeUpper();
m_EventModParamsFileID.SetWindowText(cString);
}
if (!m_bCollectingParametersForNewISO)
{
m_bChange = true;
m_pApplyButton->EnableWindow(TRUE);
}
}