本文整理汇总了C++中AfxExtractSubString函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxExtractSubString函数的具体用法?C++ AfxExtractSubString怎么用?C++ AfxExtractSubString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AfxExtractSubString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxExtractSubString
void CDataCeneter::GetMailServer(BYTE bOperation, LPVOID VarData)
{
struMail *pMailData = (struMail*)VarData;
TCHAR szData[1024] = {0};
ULONG ulChars = 1024;
CRegKey regKey;
if( regKey.Open(HKEY_LOCAL_MACHINE, GetRegFolder()) == ERROR_SUCCESS)
{
regKey.QueryStringValue(_T("SMTPSETTING"), szData,&ulChars);
}
regKey.Close();
CString csSMTPSecure, csSMTPServer, csSMTPPort, csSMTPAccount, csSMTPPassword;
AfxExtractSubString(csSMTPSecure, szData, 0, ';');
AfxExtractSubString(csSMTPServer, szData, 1, ';');
AfxExtractSubString(csSMTPPort, szData, 2, ';');
AfxExtractSubString(csSMTPAccount, szData, 3, ';');
AfxExtractSubString(csSMTPPassword, szData, 4, ';');
pMailData->SMTPSecure = (SMTP_SECURE)_ttoi(csSMTPSecure);
pMailData->SMTPServer = csSMTPServer;
pMailData->SMTPPort = csSMTPPort;
pMailData->SMTPAccount = csSMTPAccount;
pMailData->SMTPPassword = csSMTPPassword;
}
示例2: _T
/* extract CSV items using undocumented 'AfxExtractSubString()' to speed up (maybe) */
bool CCsvFile::GetItem(CStringW &item, const CStringW &line, WORD &index)
{
CStringW last_item;
bool ret = false;
last_item.Empty();
if(!AfxExtractSubString(item,line,index,','))
return false;
if(item.Left(1) == _T("\""))
{
do
{
if(item.Right(1) == _T("\""))
{
if(!last_item.IsEmpty())
item = last_item + item;
item.Trim(_T("\""));
ret = true;
break;
}
last_item += item + _T(",");
}
while(AfxExtractSubString(item,line,++index,','));
}
else
ret = true;
return ret;
}
示例3: GetLatestVersionInfo
BOOL CDialogCheckUpdate::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
CString strLatestVersionInfo = GetLatestVersionInfo(UIDESIGNER_VERSION_CHECK_URL);
CString strLastestVersion;
CString strUpdateURL;
AfxExtractSubString(strLastestVersion,strLatestVersionInfo, 0, '|');
AfxExtractSubString(strUpdateURL,strLatestVersionInfo, 1, '|');
this->GetDlgItem(IDC_STATIC_CURRENT_VERSION)->SetWindowText(UIDESIGNER_VERSION);
this->GetDlgItem(IDC_STATIC_LATEST_VERSION)->SetWindowText(strLastestVersion);
CWnd* pWndInfo = this->GetDlgItem(IDC_STATIC_UPDATE_INFO);
if(strLatestVersionInfo.IsEmpty())
pWndInfo->SetWindowText(_T("检查新版本失败!"));
else if(strLastestVersion == UIDESIGNER_VERSION)
pWndInfo->SetWindowText(_T("您的版本已经是最新!"));
else
{
m_btnUpdateURL.SetURL(strUpdateURL);
m_btnUpdateURL.SetTooltip(_T("下载最新版本"));
m_btnUpdateURL.SizeToContent();
m_btnUpdateURL.ShowWindow(SW_SHOW);
pWndInfo->SetWindowText(_T("新版本可供下载!"));
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
示例4: AfxExtractSubString
//******************************************************************************
void CBCGPRadialMenuItem::UpdateToolTip()
{
CString strText;
if (!strText.LoadString (m_nID))
{
return;
}
m_strToolTip.Empty ();
m_strDescription.Empty ();
if (strText.IsEmpty ())
{
return;
}
AfxExtractSubString (m_strDescription, strText, 0);
AfxExtractSubString (m_strToolTip, strText, 1, '\n');
const CString strDummyAmpSeq = _T("\001\001");
m_strToolTip.Replace (_T("&&"), strDummyAmpSeq);
m_strToolTip.Remove (_T('&'));
m_strToolTip.Replace (strDummyAmpSeq, _T("&"));
}
示例5: MgpEnumerateSystemPorts
void CMainDlg::OnBnClickedBtRescan()
{
CStringList ports;
CString str, port, name;
int ix, num, sel=0;
m_comPorts.ResetContent();
MgpEnumerateSystemPorts(_T("Ports"), _T("COM"), &ports);
POSITION pos = ports.GetHeadPosition();
while(pos)
{
str = ports.GetNext(pos);
AfxExtractSubString(port, str, 0, '\n');
AfxExtractSubString(name, str, 1, '\n');
if(_stscanf(port, _T("COM%i"), &num) == 1)
{
ix = m_comPorts.AddString(name);
m_comPorts.SetItemData(ix, (LPARAM) num);
if(name.Find(_T("Bootloader")) >= 0)
{
sel = ix;
}
}
}
m_comPorts.SetCurSel(sel);
}
示例6: loadHistory
BOOL CConnectRemoteMachineWindow::OnInitDialog()
{
CDialog::OnInitDialog();
m_port.SetWindowTextW(L"20099");
loadHistory();
int i = 0;
std::deque<CString>::iterator iter = m_historyCommand.begin();
for(; iter != m_historyCommand.end(); iter++)
{
if(i == 0)
{
CString output = L"";
CString output1 = L"";
AfxExtractSubString(output, (*iter), 0, _T(':'));
AfxExtractSubString(output1, (*iter), 1, _T(':'));
char* ip = KBEngine::strutil::wchar2char(output.GetBuffer(0));
m_ip.SetAddress(ntohl(inet_addr(ip)));
free(ip);
m_port.SetWindowTextW(output1);
}
i++;
m_log.AddString((*iter));
}
return TRUE; // return TRUE unless you set the focus to a control
}
示例7: AfxUnregisterShellFileTypes
void AfxUnregisterShellFileTypes()
{
CString strPathName, strTemp;
AfxGetModuleShortFileName(AfxGetInstanceHandle(), strPathName);
CString strMainFrame;
VERIFY(strMainFrame.LoadString( IDR_MAINFRAME ));
CString strFilterExt, strFileTypeId, strFileTypeName;
if (AfxExtractSubString( strFileTypeId,strMainFrame,
CDocTemplate::regFileTypeId) && !strFileTypeId.IsEmpty())
{
// enough info to register it
if (!AfxExtractSubString( strFileTypeName, strMainFrame,
CDocTemplate::regFileTypeName))
strFileTypeName = strFileTypeId; // use id name
ASSERT(strFileTypeId.Find(' ') == -1); // no spaces allowed
strTemp.Format(_afxDefaultIconFmt, (LPCTSTR)strFileTypeId);
AfxDeleteRegKey(strTemp);
// path\shell\open\command = path filename
strTemp.Format(_afxShellOpenFmt, (LPCTSTR)strFileTypeId,
(LPCTSTR)_afxCommand);
AfxDeleteRegKey(strTemp);
// path\shell\print\command = path /p filename
strTemp.Format(_afxShellPrintFmt, (LPCTSTR)strFileTypeId,
(LPCTSTR)_afxCommand);
AfxDeleteRegKey(strTemp);
// path\shell\printto\command = path /pt filename printer driver port
strTemp.Format(_afxShellPrintToFmt, (LPCTSTR)strFileTypeId,
(LPCTSTR)_afxCommand);
AfxDeleteRegKey(strTemp);
AfxExtractSubString( strFilterExt, strMainFrame, CDocTemplate::filterExt);
if (!strFilterExt.IsEmpty())
{
ASSERT(strFilterExt[0] == '.');
LONG lSize = _MAX_PATH * 2;
LONG lResult = ::RegQueryValue(HKEY_CLASSES_ROOT, strFilterExt,
strTemp.GetBuffer(lSize), &lSize);
strTemp.ReleaseBuffer();
if (lResult != ERROR_SUCCESS || strTemp.IsEmpty() ||
strTemp == strFileTypeId)
{
strTemp.Format(_afxShellNewFmt, (LPCTSTR)strFilterExt);
AfxDeleteRegKey(strTemp);
// no association for that suffix
AfxDeleteRegKey(strFilterExt);
}
}
}
}
示例8: _AfxAppendFilterSuffix
AFX_STATIC void AFXAPI _AfxAppendFilterSuffix(CString& filter, OPENFILENAME& ofn,
CString *pstrDefaultExt)
{
CString strMainFrame;
VERIFY(strMainFrame.LoadString( IDR_MAINFRAME ));
CString strFilterExt, strFilterName;
if (AfxExtractSubString(strFilterExt, strMainFrame, CDocTemplate::filterExt) &&
!strFilterExt.IsEmpty() &&
AfxExtractSubString(strFilterName, strMainFrame, CDocTemplate::filterName) &&
!strFilterName.IsEmpty())
{
// a file based document template - add to filter list
ASSERT(strFilterExt[0] == '.');
if (pstrDefaultExt != NULL)
{
// set the default extension
*pstrDefaultExt = ((LPCTSTR)strFilterExt) + 1; // skip the '.'
ofn.lpstrDefExt = (LPTSTR)(LPCTSTR)(*pstrDefaultExt);
ofn.nFilterIndex = ofn.nMaxCustFilter + 1; // 1 based number
}
// add to filter
filter += strFilterName;
ASSERT(!filter.IsEmpty()); // must have a file type name
filter += (TCHAR)'\0'; // next string please
filter += (TCHAR)'*';
filter += strFilterExt;
filter += (TCHAR)'\0'; // next string please
ofn.nMaxCustFilter++;
}
}
示例9: AfxExtractSubString
CSize CXTPPropertyGridItemSize::StringToSize(LPCTSTR str)
{
CString strWidth, strHeight;
AfxExtractSubString(strWidth, str, 0, ';');
AfxExtractSubString(strHeight, str, 1, ';');
return CSize(_ttoi(strWidth), _ttoi(strHeight));
}
示例10: CloseFile
void CEditListEditor::OpenFile(LPCTSTR lpFileName)
{
CString strLine;
CStdioFile editListFile;
CString strUser;
CString strHotFolders;
CloseFile();
m_strFileName.Format(_T("%s.edl"), lpFileName);
if (editListFile.Open(m_strFileName, CFile::modeRead)) {
m_bFileOpen = true;
while (editListFile.ReadString(strLine)) {
//int nPos = 0;
CString strIn; // = strLine.Tokenize(_T(" \t"), nPos);
CString strOut; // = strLine.Tokenize(_T(" \t"), nPos);
CString strName; // = strLine.Tokenize(_T(" \t"), nPos);
AfxExtractSubString(strIn, strLine, 0, _T('\t'));
AfxExtractSubString(strOut, strLine, 1, _T('\t'));
AfxExtractSubString(strName, strLine, 2, _T('\t'));
if (strUser.IsEmpty()) {
AfxExtractSubString(strUser, strLine, 3, _T('\t'));
SelectCombo(strUser, m_cbUsers);
}
if (strHotFolders.IsEmpty()) {
AfxExtractSubString(strHotFolders, strLine, 4, _T('\t'));
SelectCombo(strHotFolders, m_cbHotFolders);
}
if (!strIn.IsEmpty() && !strOut.IsEmpty()) {
CClip NewClip;
NewClip.SetIn(strIn);
NewClip.SetOut(strOut);
NewClip.SetName(strName);
InsertClip(nullptr, NewClip);
}
}
editListFile.Close();
} else {
m_bFileOpen = false;
}
if (m_nameList.IsEmpty()) {
CStdioFile nameFile;
CString str;
if (nameFile.Open(_T("EditListNames.txt"), CFile::modeRead)) {
while (nameFile.ReadString(str)) {
m_nameList.Add(str);
}
nameFile.Close();
}
}
}
示例11: ASSERT
// Get current setting for a file or the default settings if not yet set
// This now handles an index of -1 to get the default setting
CString CHexFileList::GetData(int index, param_num param) const
{
ASSERT(index < int(name_.size()));
CString retval;
if (index > - 1)
AfxExtractSubString(retval, data_[index], param, '|');
if (retval.IsEmpty())
AfxExtractSubString(retval, default_data_, param, '|');
return retval;
}
示例12: AfxExtractSubString
void CAddDevice::GetNetMask(CJason& jason, ec_Camera& camObj)
{
CString csNetmask;
jason.GetValuebyKey(_T("netmask"),csNetmask);
LPCTSTR lpszFullString = csNetmask.GetBuffer();
AfxExtractSubString(camObj.subnet_mask1, lpszFullString, 0, '.');
AfxExtractSubString(camObj.subnet_mask2, lpszFullString, 1, '.');
AfxExtractSubString(camObj.subnet_mask3, lpszFullString, 2, '.');
AfxExtractSubString(camObj.subnet_mask4, lpszFullString, 3, '.');
csNetmask.ReleaseBuffer();
}
示例13: ASSERT
CMDIChildWnd* CMDIFrameWnd::CreateNewChild(CRuntimeClass* pClass,
UINT nResources, HMENU hMenu /* = NULL */, HACCEL hAccel /* = NULL */)
{
ASSERT(pClass != NULL);
CMDIChildWnd* pFrame = (CMDIChildWnd*) pClass->CreateObject();
ASSERT_KINDOF(CMDIChildWnd, pFrame);
// load the frame
CCreateContext context;
context.m_pCurrentFrame = this;
pFrame->SetHandles(hMenu, hAccel);
if (!pFrame->LoadFrame(nResources,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, &context))
{
TRACE(traceAppMsg, 0, "Couldn't load frame window.\n");
return NULL;
}
CString strFullString, strTitle;
if (strFullString.LoadString(nResources))
AfxExtractSubString(strTitle, strFullString, CDocTemplate::docName);
// redraw the frame and parent
pFrame->SetTitle(strTitle);
pFrame->InitialUpdateFrame(NULL, TRUE);
return pFrame;
}
示例14: ParseToIp
void CFireView:: ParseToIp(CString str)
{
// Your code, please pay attention to the form of IP address and port!
//把每一行的字符串根据逗号分隔开
CString strTmp[8];
for(int i = 0; i < 8; i ++){
AfxExtractSubString(strTmp[i], (LPCTSTR)str, i, ',');
}
//将每行数据添加在Item列表里的首行(第0行)
AddItem(0,0,(LPCTSTR)strTmp[0]);
AddItem(0,1,(LPCTSTR)strTmp[1]);
AddItem(0,2,(LPCTSTR)strTmp[2]);
AddItem(0,3,(LPCTSTR)strTmp[3]);
AddItem(0,4,(LPCTSTR)strTmp[4]);
AddItem(0,5,(LPCTSTR)strTmp[5]);
int _proto = atoi((LPCTSTR)strTmp[6]);
CString proto;
if(_proto == 0)
proto = "ANY";
else if(_proto == 1)
proto = "ICMP";
else if(_proto == 6)
proto = "TCP";
else if(_proto == 17)
proto = "UDP";
AddItem(0,6,((LPCTSTR)proto));
int _action = atoi((LPCTSTR)strTmp[7]);
if(_action == 0)
AddItem(0,7,"ALLOW");
if(_action == 1)
AddItem(0,7,"DENY");
//对应行数增加1
_rows ++;
}
示例15: _T
BOOL CSetupWnd::LoadWndParameter(CString& strParameter)
{
CStringArray arData;
if (!m_edPath)
return FALSE;
CString sToken = _T("");
int i = 0;
while (AfxExtractSubString(sToken, strParameter, i, ','))
{
arData.Add(sToken);
i++;
}
if (arData.GetCount() != $VALUE_MAX)
return FALSE;
m_btnEnable->SetCheck(_tstoi(arData.GetAt($VALUE_ENABLE)));
CString strTemp(arData.GetAt($VALUE_PATH));
strTemp.Replace(L"\\", L"\\\\");
m_edPath->SetWindowText(strTemp);
return TRUE;
}