本文整理汇总了C++中CDuiString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::Find方法的具体用法?C++ CDuiString::Find怎么用?C++ CDuiString::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiString
的用法示例。
在下文中一共展示了CDuiString::Find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintStatusImage
void CComboBoxUI::PaintStatusImage(HDC hDC)
{
if (m_sArrowImage.IsEmpty())
CComboUI::PaintStatusImage(hDC);
else
{
// get index
if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
else m_uButtonState &= ~ UISTATE_FOCUSED;
if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
else m_uButtonState &= ~ UISTATE_DISABLED;
int nIndex = 0;
if ((m_uButtonState & UISTATE_DISABLED) != 0)
nIndex = 4;
else if ((m_uButtonState & UISTATE_PUSHED) != 0)
nIndex = 2;
else if ((m_uButtonState & UISTATE_HOT) != 0)
nIndex = 1;
else if ((m_uButtonState & UISTATE_FOCUSED) != 0)
nIndex = 3;
// make modify string
CDuiString sModify = m_sArrowImage;
int nPos1 = sModify.Find(_T("source"));
int nPos2 = sModify.Find(_T("'"), nPos1 + 7);
if (nPos2 == -1) return; //first
int nPos3 = sModify.Find(_T("'"), nPos2 + 1);
if (nPos3 == -1) return; //second
CDuiRect rcBmpPart;
LPTSTR lpszValue = NULL;
rcBmpPart.left = _tcstol(sModify.GetData() + nPos2 + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.top = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.right = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.bottom = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
m_nArrowWidth = rcBmpPart.GetWidth() / 5;
rcBmpPart.left += nIndex * m_nArrowWidth;
rcBmpPart.right = rcBmpPart.left + m_nArrowWidth;
CDuiRect rcDest(0, 0, m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top);
rcDest.Deflate(GetBorderSize(), GetBorderSize());
rcDest.left = rcDest.right - m_nArrowWidth;
CDuiString sSource = sModify.Mid(nPos1, nPos3 + 1 - nPos1);
CDuiString sReplace;
sReplace.SmallFormat(_T("source='%d,%d,%d,%d' dest='%d,%d,%d,%d'"),
rcBmpPart.left, rcBmpPart.top, rcBmpPart.right, rcBmpPart.bottom,
rcDest.left, rcDest.top, rcDest.right, rcDest.bottom);
sModify.Replace(sSource, sReplace);
// draw image
if (!DrawImage(hDC, m_sArrowImage, sModify))
m_sNormalImage.Empty();
}
}
示例2: OnAuthSuccess
void main_frame::OnAuthSuccess( CDuiString &strUrl )
{
USES_CONVERSION;
int pos = -1;
pos = strUrl.Find('=');
CDuiString retnCode = strUrl.Right(strUrl.GetLength() - pos - 1);
m_weiboManage.GetMethod()->oauth2Code(W2A(retnCode), REDIRECT_URL , NULL);
CWebBrowserUI *pLoginWeb = static_cast<CWebBrowserUI*>(m_PaintManager.FindControl(_T("loginWnd")));
if (pLoginWeb)
{
pLoginWeb->SetVisible(false);
}
CLabelUI *pUnReadTimelineCount = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("unreadTimelineCount")));
if (pUnReadTimelineCount)
{
m_PaintManager.SetTimer(pUnReadTimelineCount,1,1000*10);
}
}
示例3: SetAttribute
void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
// ÊÇ·ñÑùʽ±í
if(m_pManager != NULL) {
LPCTSTR pStyle = m_pManager->GetStyle(pstrValue);
if( pStyle != NULL) {
ApplyAttributeList(pStyle);
return;
}
}
if( _tcsicmp(pstrName, _T("pos")) == 0 ) {
RECT rcPos = { 0 };
LPTSTR pstr = NULL;
rcPos.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
rcPos.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPos.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom};
SetFixedXY(szXY);
SetFixedWidth(rcPos.right - rcPos.left);
SetFixedHeight(rcPos.bottom - rcPos.top);
}
else if( _tcsicmp(pstrName, _T("float")) == 0 ) {
CDuiString nValue = pstrValue;
// ¶¯Ì¬¼ÆËãÏà¶Ô±ÈÀý
if(nValue.Find(',') < 0) {
SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
}
else {
TPercentInfo piFloatPercent = { 0 };
LPTSTR pstr = NULL;
piFloatPercent.left = _tcstod(pstrValue, &pstr); ASSERT(pstr);
piFloatPercent.top = _tcstod(pstr + 1, &pstr); ASSERT(pstr);
piFloatPercent.right = _tcstod(pstr + 1, &pstr); ASSERT(pstr);
piFloatPercent.bottom = _tcstod(pstr + 1, &pstr); ASSERT(pstr);
SetFloatPercent(piFloatPercent);
SetFloat(true);
}
}
else if( _tcsicmp(pstrName, _T("padding")) == 0 ) {
RECT rcPadding = { 0 };
LPTSTR pstr = NULL;
rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
SetPadding(rcPadding);
}
else if( _tcsicmp(pstrName, _T("bkcolor")) == 0 || _tcsicmp(pstrName, _T("bkcolor1")) == 0 ) {
while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetBkColor(clrColor);
}
else if( _tcsicmp(pstrName, _T("bkcolor2")) == 0 ) {
while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetBkColor2(clrColor);
}
else if( _tcsicmp(pstrName, _T("bkcolor3")) == 0 ) {
while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetBkColor3(clrColor);
}
else if( _tcsicmp(pstrName, _T("forecolor")) == 0 ) {
while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetForeColor(clrColor);
}
else if( _tcsicmp(pstrName, _T("bordercolor")) == 0 ) {
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetBorderColor(clrColor);
}
else if( _tcsicmp(pstrName, _T("focusbordercolor")) == 0 ) {
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
LPTSTR pstr = NULL;
DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
SetFocusBorderColor(clrColor);
}
else if( _tcsicmp(pstrName, _T("colorhsl")) == 0 ) SetColorHSL(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) {
CDuiString nValue = pstrValue;
if(nValue.Find(',') < 0) {
SetBorderSize(_ttoi(pstrValue));
RECT rcPadding = {0};
SetBorderSize(rcPadding);
}
else {
RECT rcPadding = { 0 };
LPTSTR pstr = NULL;
rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
//.........这里部分代码省略.........
示例4: TBCIASendMessage
NSDUILIB_API void TBCIASendMessage(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
HWND hwnd = (HWND)popint();
TCHAR msgID[MAX_PATH];
TCHAR wParam[MAX_PATH];
TCHAR lParam[MAX_PATH];
EXDLL_INIT();
ZeroMemory(msgID, MAX_PATH*sizeof(TCHAR));
ZeroMemory(wParam, MAX_PATH*sizeof(TCHAR));
ZeroMemory(lParam, MAX_PATH*sizeof(TCHAR));
DEBUG_INFO("to send message stringsize %d MAX_PATH %d\n",g_stringsize,MAX_PATH);
popstring( msgID,sizeof(msgID) );
popstring( wParam,sizeof(wParam) );
popstring( lParam ,sizeof(lParam));
if( _tcsicmp( msgID, _T("WM_TBCIAMIN")) == 0 )
::SendMessage( hwnd, WM_TBCIAMIN, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIACLOSE")) == 0 )
::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIABACK")) == 0 )
::SendMessage( hwnd, WM_TBCIABACK, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIANEXT")) == 0 )
::SendMessage( hwnd, WM_TBCIANEXT, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIACANCEL")) == 0 )
{
LPCTSTR lpTitle = (LPCTSTR)wParam;
LPCTSTR lpText = (LPCTSTR)lParam;
DEBUG_BUFFER_FMT(lpTitle,_tcslen(lpTitle) + sizeof(TCHAR),"lpTitle :");
DEBUG_BUFFER_FMT(lpText,_tcslen(lpText) + sizeof(TCHAR),"lpText :");
if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
{
pushint( 0 );
::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
}
else
pushint( -1 );
}
else if (_tcsicmp( msgID, _T("WM_QAUERYCANCEL")) == 0)
{
LPCTSTR lpTitle = (LPCTSTR)wParam;
LPCTSTR lpText = (LPCTSTR)lParam;
if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
{
pushint( 0 );
}
else
pushint( -1 );
}
else if( _tcsicmp( msgID, _T("WM_TBCIASTARTINSTALL")) == 0 )
{
::SendMessage( hwnd, WM_TBCIASTARTINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
}
else if( _tcsicmp( msgID, _T("WM_TBCIASTARTUNINSTALL")) == 0 )
::SendMessage( hwnd, WM_TBCIASTARTUNINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIAFINISHEDINSTALL")) == 0 )
::SendMessage( hwnd, WM_TBCIAFINISHEDINSTALL, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIAOPTIONSTATE")) == 0 ) // 返回option的状态
{
COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
if( pOption == NULL )
return;
DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
pushint( pOption->IsSelected() );
}
else if (_tcsicmp( msgID, _T("WM_TBCIASETSTATE")) == 0)
{
COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
if( pOption == NULL )
return;
if (_tcsicmp(lParam,_T("1"))== 0)
{
pOption->Selected(true);
}
else
{
pOption->Selected(false);
}
DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
pOption->PaintStatusImage(g_pFrame->GetPaintManager().GetPaintDC());
pushint( pOption->IsSelected() );
}
else if (_tcsicmp(msgID,_T("WM_TBCIAEXIT"))==0)
{
::SendMessage(hwnd,WM_CLOSE,0,0);
}
else if( _tcsicmp( msgID, _T("WM_TBCIAOPENURL")) == 0 )
{
CDuiString url = (CDuiString)wParam;
if( url.Find( _T("https://") ) == -1 &&
url.Find(_T("http://")) == -1)
{
pushstring( _T("url error") );
return;
}
CDuiString lpCmdLine = _T("explorer \"");
lpCmdLine += url;
lpCmdLine += _T("\"");
//.........这里部分代码省略.........
示例5: SendMsg
//name 显示的名字,sText内容
int ChatDialog::SendMsg(CDuiString name,CDuiString sText)
{
CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kViewRichEditControlName));
if( pRichEdit == NULL )
{
DbgPrint("can not find kViewRichEditControlName\n");
return -1;
}
CDuiString strFolder=CPaintManagerUI::GetInstancePath();
long lSelBegin = 0, lSelEnd = 0;
CHARFORMAT2 cf;
ZeroMemory(&cf, sizeof(CHARFORMAT2));
cf.cbSize = sizeof(cf);
cf.dwReserved = 0;
cf.dwMask = CFM_COLOR | CFM_LINK | CFM_UNDERLINE | CFM_UNDERLINETYPE;
cf.dwEffects = CFE_LINK;
cf.bUnderlineType = CFU_UNDERLINE;
cf.crTextColor = RGB(220, 0, 0);
lSelEnd = lSelBegin = pRichEdit->GetTextLength();
pRichEdit->SetSel(lSelEnd, lSelEnd);
pRichEdit->ReplaceSel((LPCTSTR)name, false);
lSelEnd = pRichEdit->GetTextLength();
pRichEdit->SetSel(lSelBegin, lSelEnd);
pRichEdit->SetSelectionCharFormat(cf);
lSelEnd = lSelBegin = pRichEdit->GetTextLength();
pRichEdit->SetSel(lSelEnd, lSelEnd);
CTime time = CTime::GetCurrentTime();
CDuiString sendTime = time.Format(_T("%H:%M:%S"));
CDuiString sendtimestr;
sendtimestr.Format(_T("说:\t%s\n"),sendTime);
pRichEdit->ReplaceSel(sendtimestr, false);
//pRichEdit->ReplaceSel(_T("说:\t2011-07-30 08:30:12\n"), false);
cf.dwMask = CFM_COLOR;
cf.crTextColor = RGB(0, 0, 0);
cf.dwEffects = 0;
lSelEnd = pRichEdit->GetTextLength();
pRichEdit->SetSel(lSelBegin, lSelEnd);
pRichEdit->SetSelectionCharFormat(cf);
PARAFORMAT2 pf;
ZeroMemory(&pf, sizeof(PARAFORMAT2));
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_STARTINDENT;
pf.dxStartIndent = 0;
pRichEdit->SetParaFormat(pf);
lSelEnd = lSelBegin = pRichEdit->GetTextLength();
//插入字符串,需转移表情
//pRichEdit->SetSel(-1, -1);
//pRichEdit->ReplaceSel(sText.GetData(), false);
pRichEdit->SetSel(-1,-1);
int m,begin;
begin=0;
CDuiString temp;
char buff[2];
while(1)
{
m=sText.Find(_T("#"),begin);
if(-1!=m)
{
temp=sText.Mid(begin,m-begin);
pRichEdit->ReplaceSel(temp.GetData(),false);
int n=sText.Find(_T(".gif"),m);
//find .gif
if (n!=-1)
{
temp = sText.Mid(m+1,n-m+3);
if (frame_wnd_)
{
CDuiString strfacefolder,strface;
strfacefolder.Format(_T("%s\\skin\\Faces\\"),strFolder.GetData());
strface.Format(_T("%s\\skin\\Faces\\%s"),strFolder.GetData(),temp.GetData());
if (0==frame_wnd_->find_gif_in_folder(temp,strfacefolder))
{
// pRichEdit->InsertGif(strface);
}
begin=n+4;
m=n+4;
}
else
{
return 0;
}
}
else
{
pRichEdit->ReplaceSel(temp,false);
begin=n+1;
}
}
else
{
//.........这里部分代码省略.........
示例6: SplitFileName
void CFileUtil::SplitFileName(CDuiString fileName,CDuiString &name,CDuiString &exName)
{
name = fileName.Left(fileName.Find(L"."));
exName = fileName.Right(fileName.GetLength()-name.GetLength()-1);
}