本文整理汇总了C++中CString::GetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::GetAt方法的具体用法?C++ CString::GetAt怎么用?C++ CString::GetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::GetAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Delete
/*---------------------------------------------------------------------------
** Name : Release
** Author : Barry Tang
** Date : 2010/1/15
** Description : Delete file from disk
** Input : fileDel, the CUnicodeFile object
** Output : None
**---------------------------------------------------------------------------*/
BOOL CUnicodeFile::Delete(CUnicodeFile& fileDel)
{
CString strName = fileDel.GetFileName();
if (strName.IsEmpty())
{
AfxMessageBox(_T("The file is release..."));
return FALSE;
}
int num = strName.GetLength();
char* operate = new char[num + 5];
operate[0] = 'D';
operate[1] = 'e';
operate[2] = 'l';
operate[3] = ' ';
int i;
for (i = 0; i < num; i++)
{
operate[4 + i] = (char)LOWORD(strName.GetAt(i));
}
operate[4 + i] = '\0';
fileDel.Release();
system(operate);
delete[] operate;
return TRUE;
}
示例2: CheckRangeFloat
// Number can be: nnnnn[.nnnnnn][[+|-]{E|e}nnn]
CString
XMLRestriction::CheckDouble(CString p_value,bool p_specials)
{
CString result;
p_value.TrimLeft('-');
p_value.TrimLeft('+');
if(p_specials)
{
if(p_value == "INF" || p_value == "NaN")
{
return result;
}
}
for(int ind = 0; ind < p_value.GetLength(); ++ind)
{
unsigned char ch = p_value.GetAt(ind);
if(!isspace(ch) && !isdigit(ch) && ch != '.' && ch != '+' && ch != '-' && toupper(ch) != 'E')
{
result = "Not a number: ";
result += p_value;
return result;
}
}
return CheckRangeFloat(p_value);
}
示例3: Load
BOOL PhoneInfoMng::Load()
{
m_ObArr.RemoveAll();
m_Cnt = 0;
TCHAR strModuleFileName[256];
CString strPath;
memset((void *)strModuleFileName,0,256);
GetModuleFileName(NULL,strModuleFileName,256);
strPath = strModuleFileName;
UINT iPos=-1;
for(int i=strPath.GetLength()-1;i>=0;i--)
{
TCHAR ch = strPath.GetAt(i);
if(ch==L'\\')
{
iPos = i;
break;
}
}
CString strFullPath = strPath.Left(iPos+1) + _T("Tel\\Tel");
CFile DialBookFile;
if( !DialBookFile.Open(strFullPath, CFile::modeReadWrite ) )
return FALSE;
if( DialBookFile.GetLength() == 0 )
return FALSE;
TCHAR* bookBuf = new TCHAR[4096];
CArchive ar(&DialBookFile,CArchive::load,4096,bookBuf);
ar >> m_Cnt;
if( m_Cnt == 0 )
return FALSE;
CPhoneInfo* temppDialLog;
m_PhoneInfo = new CPhoneInfo[m_Cnt];
temppDialLog = m_PhoneInfo;
for( UINT j = 0; j<m_Cnt; j++ )
{
temppDialLog->Serialize(ar);
m_ObArr.Add(temppDialLog);
temppDialLog++;
}
ar.Flush();
ar.Close();
DialBookFile.Close();
delete[] bookBuf;
return TRUE;
}
示例4: ApplyExpandedMask
// This takes a string and uses it to set the expanded or
// collapsed state of the tree items.
int CStatisticsTree::ApplyExpandedMask(CString theMask, HTREEITEM theItem, int theStringIndex)
{
HTREEITEM hCurrent;
if (theItem == NULL) {
hCurrent = GetRootItem();
SetRedraw(false);
ExpandAll(true);
m_bExpandingAll = true;
}
else
hCurrent = theItem;
while (hCurrent != NULL && theStringIndex < theMask.GetLength())
{
if (ItemHasChildren(hCurrent) && IsBold(hCurrent)) {
if (theMask.GetAt(theStringIndex) == '0') Expand(hCurrent, TVE_COLLAPSE);
theStringIndex++;
theStringIndex = ApplyExpandedMask(theMask, GetChildItem(hCurrent), theStringIndex);
}
hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
}
if (theItem == NULL) {
SetRedraw(true);
m_bExpandingAll = true;
}
return theStringIndex;
}
示例5:
CString
XMLRestriction::CheckFractionDigits(CString p_value)
{
CString error;
int pos = p_value.Find('.');
if(pos >= 0)
{
// Take fractin part
p_value = p_value.Mid(pos + 1);
int count = 0;
for(int ind = 0; ind < p_value.GetLength(); ++ind)
{
if(isdigit(p_value.GetAt(pos)))
{
++count;
}
else
{
// Stop counting at the 'E' or 'e' sign of the exponent
break;
}
}
if(count > m_fractionDigits)
{
error.Format("Number precision overflow fractionDigits %d/%d",count,m_fractionDigits);
}
}
return error;
}
示例6: IPtoDWORD
//转CString为DWORD,GetIndex(CString szIP)函数中用到
DWORD SEU_QQwry::IPtoDWORD(CString szIP)
{
DWORD iIP;
BYTE b[4];
CString szTemp;
char ch;
int iLen;
int iXB;
szIP+=".";
memset(b,0,4);
iLen=szIP.GetLength();
iXB=0;
iIP=0;
for(int i=0;i<iLen;i++)
{
ch=szIP.GetAt(i);
szTemp+=ch;
if(ch=='.')
{
b[iXB]=atoi(szTemp);
szTemp="";
iXB++;
}
}
iIP=b[0]*256*256*256+b[1]*256*256+b[2]*256+b[3];
return iIP;
}
示例7: ValidateLabel
BOOL CVolume::ValidateLabel(const CString& strLabel)
{
CString strTemp = strLabel;
strTemp.Trim();
// Check length.
if (strTemp.IsEmpty() || strTemp.GetLength() >3) return FALSE;
// Check label.
strTemp.MakeUpper();
TCHAR chLabel = strTemp.GetAt(0);
if (chLabel < _T('A') || chLabel > _T('Z')) return FALSE;
// Check whole string.
switch (strTemp.GetLength())
{
case 1:
return TRUE;
case 2:
{
CString strCompare;
strCompare.Format(_T("%c:"),chLabel);
return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
}
case 3:
{
CString strCompare;
strCompare.Format(_T("%c:\\"),chLabel);
return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
}
default:
return FALSE;
}
}
示例8: IsVolumeExist
BOOL CVolumeCollection::IsVolumeExist(const CString& strLabel)
{
if (!CVolume::ValidateLabel(strLabel)) return FALSE;
CVolume::ValidateLabel(strLabel);
return m_dwVolumes & (0x1 << (strLabel.GetAt(0) - _T('A'))) ? TRUE : FALSE;
}
示例9: check_date_input
void CExtIdDetail::check_date_input( CEdit &EditDate )
{
CString DateString;
EditDate.GetWindowText(DateString);
int iIsSlash;
int iIsNum;
int status = ABP_FAILURE;
int size = 0;
TCHAR CurrentChar;
if( !DateString.IsEmpty() )
{
CurrentChar = DateString.GetAt((size = DateString.GetLength() - 1));
if( (iIsNum = isdigit( (int)CurrentChar)) ||
!(iIsSlash = strncmp( (LPCTSTR)&CurrentChar, (LPCTSTR)"/", 1)) )
{
if( ((iIsNum >= 0) && (iIsNum <= 9)) || (!iIsSlash ) ) status = ABP_SUCCESS;
}
if( status == ABP_FAILURE )
{
Beep( 400, 75 );
DateString.GetBufferSetLength( size );
}
}
return;
}
示例10: GetTextFromReg
void T3000_Default_MainView::OnEnKillfocusEditAesEncrypt()
{
CString str;
m_Edit_AESPassword.GetWindowTextW(str);
if (str.GetLength()<=0)
{
return;
}
unsigned char AESPwd[16];
memset(AESPwd, 0, 16);
for (int i = 0;i<str.GetLength();i++)
{
AESPwd[i] = str.GetAt(i);
}
int ret = Write_Multi_org(g_tstat_id, AESPwd, 600, 16, 5);
Read_Multi(g_tstat_id, &product_register_value[599], 599, 100);
if (product_register_value[599] == 0)
{
m_Edit_AESPassword.EnableWindow(FALSE);
GetDlgItem(IDC_CHECK_PASSWORD)->EnableWindow(FALSE);
}
else
{
m_Edit_AESPassword.EnableWindow(TRUE);
m_Edit_AESPassword.SetWindowTextW(GetTextFromReg(600) + GetTextFromReg(604));
//m_Edit_AESPassword.SetPasswordChar('*');
((CButton *)GetDlgItem(IDC_CHECK_PASSWORD))->SetCheck(1);
}
}
示例11: CStringHexToInt
//===========================================================================
int CFAVReaderDlg::CStringHexToInt(CString str)
//===========================================================================
{
int nRet = 0;
int count = 1;
for(int i = str.GetLength()-1; i >= 0; --i)
{
int nNum = 0;
char chText;
chText = str.GetAt(i);
if (chText >= '0' && chText <= '9')
{
nNum = chText - '0';
}
else if (chText >= 'A' && chText <= 'F')
{
nNum = chText - 'A' + 10;
}
else if (chText >= 'a' && chText <= 'f')
{
nNum = chText - 'a' + 10;
}
nRet += nNum*count;
count *= 16;
}
return nRet;
}
示例12: FromAToB
void FromAToB(){
DWORD dwRead, dwWrite;
char* pReadBuf;
CString cStrData;
char* pSendData;
while (1){
pReadBuf = new char[101];
//从匿名通道读入
if (!ReadFile(hPipeRead, pReadBuf, 101, &dwRead, NULL)){
printf("read failed\n");
}
cStrData.Empty();
cStrData = pReadBuf;
while (!cStrData.IsEmpty()){
pSendData = new char[cStrData.GetLength() + 1];
memset(pSendData, 0, cStrData.GetLength() + 1);
for (int i = 0; i < cStrData.GetLength() + 1; i++){
pSendData[i] = (char)cStrData.GetAt(i);
}
//将从A中读入的数据通过匿名通道写入B
if (!WriteFile(hPipeWrite, pReadBuf, strlen(pReadBuf), &dwWrite, NULL)){
printf("write failed\n");
}
}
}
}
示例13: GetAppPath
bool CStringExt::GetAppPath(CString &path)//不包括最后的'\\'
{
CString sPath;
GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer();
int i=sPath.GetLength()-1;
while(i>0)
{
if(sPath.GetAt(i)=='/' || sPath.GetAt(i)=='\\') break;
i--;
}
if(i<0) return false;
if(i==0) path="./";
else path=sPath.Left(i);
return true;
}
示例14: GetEither
//when function encounters symbol '|'
//that means either character can be, it
//calls this function to get these characters
BOOL COXRegExpression::GetEither(CString& sString,int* pnNumber,LPTSTR pchEither)
{
TCHAR ch;
if (sString.GetLength()<=(*pnNumber))
{
SetError(OX_REGEXP_ERROR_UNEXPECTED_END_EITHER);
return FALSE;
}
ch=sString.GetAt(*pnNumber);
(*pnNumber)++;
switch (ch)
{
case TEXT('\\'):
{
int nRet=GetSpecialChar(sString, pnNumber, &ch);
if (nRet==OX_REGEXP_TAG_COMMON_CHAR)
{
*pchEither=ch;
return TRUE;
}
else
{
if (nRet)
SetError(OX_REGEXP_ERROR_UNEXPECTED_SPECCHAR);
return FALSE;
}
}
break;
case TEXT('*'):
case TEXT('+'):
case TEXT('?'):
case TEXT('.'):
case TEXT('('):
case TEXT(')'):
case TEXT('|'):
case TEXT('{'):
case TEXT('}'):
case TEXT('['):
case TEXT(']'):
{
SetError(OX_REGEXP_ERROR_UNEXPECTED_SPECCHAR);
return FALSE;
}
case TEXT('/'):
if (GetAsciiChar(sString,pnNumber,&ch))
{
*pchEither=ch;
return TRUE;
}
else
return FALSE;
break;
default:
*pchEither=ch;
return TRUE;
}
}
示例15: HashSCKey
bool HashSCKey (char *key , CString strkey)
{
strcpy (key,"qwertyuiopasdfghjk");
for (int i=0;i<strkey.GetLength();i++)
key[i] = key[i] ^ strkey.GetAt(i);
return true;
}