本文整理汇总了C++中CString::ReverseFind方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::ReverseFind方法的具体用法?C++ CString::ReverseFind怎么用?C++ CString::ReverseFind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::ReverseFind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADOOpenDBCon
//打开指定数据库对象连接
int CCommDBOper::ADOOpenDBCon(_ConnectionPtr &pCon,const CString strDBPathName,
const CString strDBFileName,CString &strPassword,int iWarn)
{
//函数功能 打开指定数据库
//输入参数说明 pCon 要打开的数据库对象,strDBPathName 要连接的ACCESS数据库文件目录
// strDBFileName 要打开的数据库文件名,strPassword 密码
// iWarn 出错警告方式 0,不警告,1,警告,2,警告且退出程序
//作者 LFX
CString tstrDBPathName;
tstrDBPathName = strDBPathName;
if (!strDBFileName.IsEmpty())
{
//目录是否合法
int iret1;
iret1 = tstrDBPathName.FindOneOf("*?\"<>|");
if (iret1 != -1)
{
CString strTemp;
strTemp.Format("数据库(%s)的目录(%s)非法!!!",strDBFileName,strDBPathName);
WarnMessage(strTemp,iWarn);
return RET_FAILED;
}
iret1 = tstrDBPathName.ReverseFind('\\');
if (iret1 != 1)
{
tstrDBPathName += "\\";
}
}
CString strDB;
strDB.Empty();
strDB += tstrDBPathName;
strDB += strDBFileName;
return ADOOpenDBCon(pCon,strDB,strPassword,iWarn);
}
示例2: OnImport
void CSubdivisionDoc::OnImport()
{
CString lpszFilter = _T("Obj files (*.obj)|*.obj|Off files (*.off)|*.off||");
CFileDialog dlg(true, NULL, NULL, OFN_READONLY, lpszFilter);
dlg.m_ofn.lpstrTitle = _T("Import 3D model"); ////
dlg.m_ofn.lpstrDefExt = _T("obj");
if(dlg.DoModal() == IDOK)
{
CString strFile = dlg.GetPathName();
// delete m_pmesh, m_pmesh = NULL;
if (m_pmesh==NULL) {
m_pmesh = new Mesh3D;
}
CString extension = strFile;
extension = extension.Right(extension.GetLength()-extension.ReverseFind('.'));
extension.MakeLower();
if (extension == ".off")
{
CStringA ss(strFile);
m_pmesh->load_off((LPCSTR)(ss));
}
else if (extension == ".obj")
{
//const char * ss = CString2constchar(strFile);
CStringA ss(strFile);
m_pmesh->load_obj((LPCSTR)(ss));
}
m_pmesh->update_mesh();
}
UpdateAllViews(NULL);
}
示例3: MakeCRs
LRESULT CJobsConfigure::OnP4Describe( WPARAM wParam, LPARAM lParam )
{
CCmd_Describe *pCmd = ( CCmd_Describe * )wParam;
MainFrame()->ClearStatus();
if(!pCmd->GetError())
{
int i;
CString desc = MakeCRs( pCmd->GetDescription( ) );
if ((i = desc.ReverseFind(_T('#'))) != -1)
{
if ((i = desc.Find(_T('\n'), i)) != -1)
desc = desc.Left(i+1);
}
int key;
CSpecDescDlg *dlg = new CSpecDescDlg(this);
dlg->SetIsModeless(TRUE);
dlg->SetKey(key = pCmd->HaveServerLock()? pCmd->GetServerKey() : 0);
dlg->SetDescription( desc, FALSE );
dlg->SetCaption( LoadStringResource(IDS_P4WIN_SPECIFICATION_NOTES) );
dlg->SetWinPosName(_T("JobSpecInfo"));
CRect rect;
GetWindowRect(&rect);
rect.top += rect.Height() - 10;
rect.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
rect.right = GetSystemMetrics(SM_CXFULLSCREEN);
dlg->SetWinPosDefault(rect);
if (!dlg->Create(IDD_SPECDESC, this)) // display the description dialog box
{
dlg->DestroyWindow(); // some error! clean up
delete dlg;
}
}
delete pCmd;
GotoDlgCtrl(GetDlgItem(IDC_LIST_OTHER));
return 0;
}
示例4: makeKey
static LONG makeKey(HKEY root, const CString & path, HKEY * key)
{
LONG result = ::RegOpenKey(root, path, key);
if(result == ERROR_SUCCESS)
return result;
// We have a path of the form a\b\c\d
// But apparently a/b/c doesn't exist
int i = path.ReverseFind(_T('\\'));
if(i == -1)
return result; // well, we lose
CString s;
s = path.Left(i);
HKEY newkey;
result = makeKey(root, s, &newkey);
if(result != ERROR_SUCCESS)
return result;
// OK, we now have created a\b\c
CString v;
v = path.Right(path.GetLength() - i - 1);
DWORD disp;
result = ::RegCreateKeyEx(newkey,
v,
0, NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
key,
&disp);
::RegCloseKey(newkey); // no longer needed // REQ #278
return result;
}
示例5: UpdateUserInfo
BOOL CCrashInfoReader::UpdateUserInfo(CString sEmail, CString sDesc)
{
// This method validates user-provided Email and problem description
// and (if valid) uptdates internal fields.
BOOL bResult = TRUE;
// If an email address was entered, verify that
// it [1] contains a @ and [2] the last . comes
// after the @.
if (sEmail.GetLength()!=0 &&
(sEmail.Find(_T('@')) < 0 ||
sEmail.ReverseFind(_T('.')) <
sEmail.Find(_T('@'))))
{
// Invalid email
bResult = FALSE;
}
else
{
// Update email
GetReport(0)->m_sEmailFrom = sEmail;
}
// Update problem description
GetReport(0)->m_sDescription = sDesc;
// Write user email and problem description to XML
AddUserInfoToCrashDescriptionXML(
GetReport(0)->m_sEmailFrom,
GetReport(0)->m_sDescription);
// Save E-mail entered by user to INI file for later reuse.
SetPersistentUserEmail(sEmail);
return bResult;
}
示例6: sizeof
CmdwEditorDoc::CmdwEditorDoc()
{
// TODO: add one-time construction code here
TCHAR buf[1024];
::GetModuleFileName(NULL, buf, sizeof(buf));
TRACE( _T("exe path = %s\n"), buf);
CString tmp = CString(buf);
int idx = tmp.ReverseFind('\\');
if(idx > 0) {
m_AppPath = tmp.Left(idx+1);
}
else {
m_AppPath = tmp + _T('\\');
::CreateDirectory(m_AppPath, NULL);
}
m_cssPath = m_AppPath + _T("mdwdefault.css");
m_htmlPath = m_AppPath + _T("preview_001.html");
m_bHtmlExisted = FALSE;
checkDefaultCSS();
}
示例7: OpenAtExeDirectory
BOOL CIniEx::OpenAtExeDirectory(LPCTSTR pFileName,
BOOL writeWhenChange,/*=TRUE*/
BOOL createIfNotExist/*=TRUE*/,
BOOL noCaseSensitive /*=TRUE*/,
BOOL makeBackup /*=FALSE*/)
{
CString filePath;
//if it's a dll argv will be NULL and it may cause memory leak
#ifndef _USRDLL
CString tmpFilePath;
int nPlace=0;
tmpFilePath=__argv[0];
nPlace=tmpFilePath.ReverseFind('\\');
if (nPlace!=-1)
{
filePath=tmpFilePath.Left(nPlace);
}
else
{
TCHAR curDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH,curDir);
filePath=curDir;
}
#else
//it must be safe for dll's
TCHAR curDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH,curDir);
filePath=curDir;
#endif
filePath+="\\";
filePath+=pFileName;
return Open(filePath,writeWhenChange,createIfNotExist,noCaseSensitive,makeBackup);
}
示例8: OnDoLabelDelFiles
LRESULT CLabelListCtrl::OnDoLabelDelFiles(WPARAM wParam, LPARAM lParam)
{
BOOL preview = FALSE;
if (wParam == IDOK)
{
preview = lParam;
if (m_DelSyncList.GetCount())
{
POSITION pos2;
for (POSITION pos1 = m_DelSyncList.GetHeadPosition(); ( pos2 = pos1 ) != NULL; )
{
CString str = m_DelSyncList.GetNext(pos1);
int i = str.ReverseFind(_T('#'));
if (i != -1)
str = str.Left(i);
str += _T("#none");
m_DelSyncList.SetAt(pos2, str);
}
CCmd_LabelSynch *pCmd= new CCmd_LabelSynch;
pCmd->Init( m_hWnd, RUN_ASYNC);
if( pCmd->Run( m_DelSyncName, &m_DelSyncList, preview, FALSE, FALSE ) )
MainFrame()->UpdateStatus( LoadStringResource(IDS_SYNCING_LABEL) );
else
delete pCmd;
}
else
AddToStatus(LoadStringResource(IDS_NOTHING_SELECTED_NOTHING_TO_DO));
}
if (m_DelSyncDlg && !preview)
{
m_DelSyncDlg->DestroyWindow(); // deletes m_DelSyncDlg
m_DelSyncDlg = 0;
MainFrame()->SetModelessUp(FALSE);
}
return 0;
}
示例9: _InitUIResource
void KAppModule::_InitUIResource()
{
//BkFontPool::SetDefaultFont(BkString::Get(IDS_APP_FONT), -12);
if ( TRUE /*_CmdLine.HasParam(L"{69DD4969-E6C4-42d9-A508-105DDA13CE40}")*/)
{
CString strPath;
GetModuleFileName((HMODULE)&__ImageBase, strPath.GetBuffer(MAX_PATH + 10), MAX_PATH);
strPath.ReleaseBuffer();
strPath.Truncate(strPath.ReverseFind(L'\\') + 1);
strPath += L"res\\safeflow";
if ( PathFileExists(strPath) )
BkResManager::SetResourcePath(strPath);
}
BkFontPool::SetDefaultFont(_T("宋体"), -12);
BkSkin::LoadSkins(IDR_BK_SKIN_DEF);
BkStyle::LoadStyles(IDR_BK_STYLE_DEF);
BkString::Load(IDR_BK_STRING_DEF);
}
示例10: OnInitDialog
BOOL COptionPageLanguage::OnInitDialog()
{
CMFCPropertyPage::OnInitDialog();
//Set URLs
CString DictURL;
DictURL.LoadString(ID_URL_TCDICTDOWNLOAD);
int idLastLineBreak = DictURL.ReverseFind(_T('\n'));
ASSERT(idLastLineBreak > 0);
m_wndURLDownloadDicts.SetURL(DictURL.Mid(idLastLineBreak + 1));
m_wndURLDownloadDicts.SizeToContent(true,true);
FindDictionaries();
CComboBox *pLangBox = (CComboBox*)GetDlgItem(IDC_OPTIONS_LANGUAGE);
// Add all the found languages
for (int i = 0; i < m_aLanguage.GetSize(); ++i)
{
if (pLangBox->FindString(0,m_aLanguage[i]) == CB_ERR)
pLangBox->AddString(m_aLanguage[i]);
}
// Select the language
int nSel = pLangBox->FindStringExact(0,m_strLanguageDefault);
if (nSel == CB_ERR)
pLangBox->SetCurSel(0);
else
pLangBox->SetCurSel(nSel);
OnSelchangeOptionsLanguage();
UpdateControlStates();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例11: OnBnClickedButtonBrowse
void CFileSelectDlg::OnBnClickedButtonBrowse()
{
// TODO: Add your control notification handler code here
CString csEditText;
m_edtFileName.GetWindowText(csEditText);
int pos = csEditText.ReverseFind(_T('\\'));
CString csDefName = _T("");
if(pos != -1)
{
csDefName = csEditText.Right(csEditText.GetLength() - pos - 1);
csDefName.Left(csDefName.GetLength() - 4);
}
static TCHAR szFilter[] = _T("LECTURNITY Source Documents (*.lsd)|*.lsd|All Files (*.*)|*.*||");
CFileDialog fDlg(false, _T(".lsd"), /*NULL*/csDefName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
CString csLsdName;
if(fDlg.DoModal() == IDOK)
{
m_edtFileName.SetWindowText(fDlg.GetPathName());
}
}
示例12: CheckFolder
BOOL CHttpFileDownload::CheckFolder(CString strPath)
{
CString strFindPath = strPath;
CString strTmp;
BOOL bSuccess = TRUE;
int nFind = 3;
int nEnd = strPath.ReverseFind('\\');
HTTP_CANCEL();
while(nFind <= nEnd && bSuccess)
{
HTTP_CANCEL();
nFind = strPath.Find('\\', nFind);
strTmp = strFindPath.Left( nFind );
bSuccess = CreateCheck(strTmp);
nFind++;
}
if(!bSuccess)
return FALSE;
return TRUE;
/*
if(_chdir((LPCSTR)(LPCTSTR)strPath) == 0)
return TRUE;
else{
if(_mkdir((LPCSTR)(LPCTSTR)strPath) == 0)
return TRUE;
else{
// ErrMsgBox("Failed to Create Download Directory!");
return FALSE;
}
}
*/
}
示例13: SaveTrainModel
bool CNetWorker::SaveTrainModel(const char* pPath)
{
Stringoper oper;
char path[MAX_PATH];
strcpy_s(path, pPath);
CString modelpath = oper.chartocstring(path);
CFile file;
file.Open(modelpath, CFile::modeWrite|CFile::modeCreate); //清空原来文件
file.SetLength(0);
file.Close();
if (m_BpNet.m_nTrainArithmetic == 2) //FANN 模型,保留附加参数
{
int index = modelpath.ReverseFind('.');
if (index != -1)
{
modelpath.Insert(index, _T("_Append_"));
}
else
modelpath += _T("_Append_");
}
return m_BpNet.SaveWeighttoFile(modelpath);
}
示例14: ProcessData
/////////////////////////////////////////////////////////////////////////////
// data processing
/////////////////////////////////////////////////////////////////////////////
void CDropListCtrl::ProcessData(CString strData)
{
int idx;
int iIns;
int iTab;
int iIndex;
CDropStatic *pButton;
//get the button in question
pButton = ((CNewGameDialog *) GetParent())->getDropButton();
//remove the data from the button
if(pButton) pButton->dropItem();
//unformat the text
iTab = strData.ReverseFind('\t');
//get the index
idx = atoi(strData.Right(strData.GetLength() - iTab - 1));
//chop it off
strData = strData.Left(iTab);
//get the id
iIndex = atoi(strData);
//insert the text in
iIns = InsertItem(GetItemCount(), PLAYERS->getPlayer(iIndex).getCommaName());
SetItemData(iIns, iIndex);
//reset the selection
setSelection();
//call the sort function
sort();
}
示例15: ReadLine
BOOL CBuffer::ReadLine(CString& strLine, UINT nCodePage, BOOL bPeek)
{
DWORD nLength; for ( nLength = 0 ; nLength < m_nLength ; nLength++ )
{
if ( m_pBuffer[ nLength ] == '\n' ) break;
}
if ( nLength >= m_nLength ) return FALSE;
int nWide = MultiByteToWideChar( nCodePage, 0, (LPCSTR)m_pBuffer, nLength, NULL, 0 );
LPWSTR pszWide = new WCHAR[ nWide ];
MultiByteToWideChar( nCodePage, 0, (LPCSTR)m_pBuffer, nLength, pszWide, nWide );
strLine = CString(pszWide, nWide);
delete [] pszWide;
int nCR = strLine.ReverseFind( '\r' );
if ( nCR >= 0 ) strLine = strLine.Left( nCR );
if ( ! bPeek ) Remove( nLength + 1 );
return TRUE;
}