本文整理汇总了C++中CDuiString::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::GetData方法的具体用法?C++ CDuiString::GetData怎么用?C++ CDuiString::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiString
的用法示例。
在下文中一共展示了CDuiString::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xml
IMPL_LUA_FUNC(LuaWindowExport, RegisterSkin)
{
try
{
CLuaWindow* self;
self = static_cast<CLuaWindow*>(LuaStatic::CheckUserData(l, 1));
STRINGorID xml(_T(""));
if (lua_isnumber(l, 2))
xml = STRINGorID(lua_tointeger(l, 2));
else if (lua_isstring(l, 2))
{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);
xml = STRINGorID(pstrText.GetData());
}
LPCTSTR type = NULL;
if (lua_isstring(l, 3))
{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 3, pstrText);
type = pstrText.GetData();
}
IDialogBuilderCallback* pCallBack = static_cast<IDialogBuilderCallback*>(self);
CControlUI* pParent = NULL;
if (lua_isuserdata(l,5))
pParent = static_cast<CControlUI*>(LuaStatic::CheckUserData(l, 5));
lua_pushboolean(l, self->RegisterSkin(xml, type, pCallBack, pParent) ? 1 : 0);
return 1;
}
catch(...)
{
DuiException(_T("LuaWindowExport::MapWindowPoints2"));
return 0;
}
}
示例2: AddVirtualWnd
bool CNotifyPump::AddVirtualWnd(CDuiString strName,CNotifyPump* pObject)
{
if( m_VirtualWndMap.Find(strName.GetData()) == NULL )
{
m_VirtualWndMap.Insert(strName.GetData(),(LPVOID)pObject);
return true;
}
return false;
}
示例3: RemoveVirtualWnd
bool CNotifyPump::RemoveVirtualWnd(CDuiString strName)
{
if( m_VirtualWndMap.Find(strName.GetData()) != NULL )
{
m_VirtualWndMap.Remove(strName.GetData());
return true;
}
return false;
}
示例4: InitResource
void InitResource()
{
// 资源类型
CPaintManagerUI::SetResourceType(UILIB_FILE);
// 资源路径
CDuiString strResourcePath = CPaintManagerUI::GetInstancePath();
// 加载资源
switch(CPaintManagerUI::GetResourceType())
{
case UILIB_FILE:
{
strResourcePath += _T("skin\\animationWindow\\");
CPaintManagerUI::SetResourcePath(strResourcePath.GetData());
// 加载资源管理器
CResourceManager::GetInstance()->LoadResource(_T("res.xml"), NULL);
break;
}
case UILIB_RESOURCE:
{
strResourcePath += _T("skin\\animationWindow\\");
CPaintManagerUI::SetResourcePath(strResourcePath.GetData());
// 加载资源管理器
CResourceManager::GetInstance()->LoadResource(_T("IDR_RES"), _T("xml"));
break;
}
case UILIB_ZIP:
{
strResourcePath += _T("skin\\");
CPaintManagerUI::SetResourcePath(strResourcePath.GetData());
CPaintManagerUI::SetResourceZip(_T("animationWindow.zip"), true);
// 加载资源管理器
CResourceManager::GetInstance()->LoadResource(_T("res.xml"), NULL);
break;
}
case UILIB_ZIPRESOURCE:
{
strResourcePath += _T("skin\\animationWindow\\");
CPaintManagerUI::SetResourcePath(strResourcePath.GetData());
HRSRC hResource = ::FindResource(CPaintManagerUI::GetResourceDll(), _T("IDR_ZIPRES"), _T("ZIPRES"));
if( hResource != NULL ) {
DWORD dwSize = 0;
HGLOBAL hGlobal = ::LoadResource(CPaintManagerUI::GetResourceDll(), hResource);
if( hGlobal != NULL ) {
dwSize = ::SizeofResource(CPaintManagerUI::GetResourceDll(), hResource);
if( dwSize > 0 ) {
CPaintManagerUI::SetResourceZip((LPBYTE)::LockResource(hGlobal), dwSize);
// 加载资源管理器
CResourceManager::GetInstance()->LoadResource(_T("res.xml"), NULL);
}
}
::FreeResource(hResource);
}
}
break;
}
}
示例5: DoPaint
void YPlayListItemUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
if( !::IntersectRect(&m_rcPaint, &rcPaint, &m_rcItem) ) return;
ASSERT(GetOwner());
if (_spList)
{
// int nCurPlayListLocalId = thePlayCenter->GetListIndex();
// if (_spList->GetLocalId()==nCurPlayListLocalId)
spPlayListInfoT spList = thePlayListMgr->GetCurList();
if(spList&&spList->GetLocalId()==_spList->GetLocalId())
{
CDuiString sText = _spList->GetName();
TCHAR szBuf[MAX_PATH] = {0};
#if defined(UNDER_WINCE)
_stprintf(szBuf, _T("<f 1><c #F27D30>%s</c></f>"), sText.GetData());
#else
_stprintf_s(szBuf, MAX_PATH - 1, _T("<f 1><c #F27D30>%s</c></f>"), sText.GetData());
#endif
_spListName->SetText(szBuf);
static CDuiString sPlayImg = _spPlayIco->GetBkImage();
static CDuiString sPauseImg = _spPlayIco->GetUserData();
int nStatus = thePlayer->GetStatus();
ChangeIcon(nStatus);
// RECT rt = {15,0,0,0};
// #define BK_IMG_PLAYING _T("file='YTing/Menu/play.png' source='13,0,26,13' dest='2,8,15,21' mask='0xFF000000'")
// _spListName->SetFont(1);
// _spListName->SetTextPadding(rt);
// _spListName->SetText(sText);
// _spListName->SetBkImage(BK_IMG_PLAYING);
// _spListName->ApplyAttributeList(_T("font=\"3\" bkimage=\"file='YTing/Menu/play.png' source='13,0,26,13' dest='2,8,15,21' mask='0xFF000000'\" textpadding=\"15,0,0,0\""));
}
else
{
CDuiString sText = _spList->GetName();
TCHAR szBuf[MAX_PATH] = {0};
#if defined(UNDER_WINCE)
_stprintf(szBuf, _T("<f 0>%s</f>"), sText.GetData());
#else
_stprintf_s(szBuf, MAX_PATH - 1, _T("<f 0>%s</f>"), sText.GetData());
#endif
_spListName->SetText(szBuf);
ChangeIcon(em_stop);
// RECT rt = {0,0,0,0};
// #define BK_IMG_NORMAL _T("")
// _spListName->SetFont(1);
// _spListName->SetTextPadding(rt);
// _spListName->SetText(sText);
// _spListName->SetBkImage(BK_IMG_NORMAL);
}
}
__super::DoPaint(hDC,rcPaint);
}
示例6: OnCreate
LRESULT CShadowWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// 使用xml字符串形式加载皮肤,内容很简单,一个Container控件就够了!Window要有bktrans属性
CDuiString xml;
xml.Append(_T("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>"));
xml.Append(_T("<Window size=\"%d,%d\" bktrans=\"true\">"));
xml.Append(_T(" <Container />"));
xml.Append(_T("</Window>"));
xml.Format(xml.GetData(), m_pShadowUI->GetFixedWidth(), m_pShadowUI->GetFixedHeight());
m_pManager->Init(m_hWnd);
CDialogBuilder builder;
CControlUI* pRoot = builder.Create((LPCTSTR)xml, (UINT)0, NULL, m_pManager);
if (pRoot == NULL)
{
MessageBox(m_hWnd, _T("加载资源文件失败"), _T("错误"), MB_OK | MB_ICONERROR);
ExitProcess(1);
return 0;
}
m_pManager->AttachDialog(pRoot);
// 为主窗口设置一个属性,内容为阴影窗口的指针,然后子类化主窗口
::SetProp(m_hWndOwner, SHADOW_WINDOW_PROP, (HANDLE) this);
m_pOldOwnerProc = (WNDPROC) ::SetWindowLongPtr(m_hWndOwner, GWL_WNDPROC, (LONG) OwnerProc);
return 0;
}
示例7: CreateControl
CControlUI* CDuiFrameWnd::CreateControl( LPCTSTR pstrClassName )
{
CDuiString strXML;
CDialogBuilder builder;
if (_tcsicmp(pstrClassName, _T("Caption")) == 0)
{
strXML = _T("Caption.xml");
}
else if (_tcsicmp(pstrClassName, _T("PlayPanel")) == 0)
{
strXML = _T("PlayPanel.xml");
}
else if (_tcsicmp(pstrClassName, _T("Playlist")) == 0)
{
strXML = _T("Playlist.xml");
}
else if (_tcsicmp(pstrClassName, _T("WndMediaDisplay")) == 0)
{
CWndUI *pUI = new CWndUI;
HWND hWnd = CreateWindow(_T("#32770"), _T("WndMediaDisplay"), WS_VISIBLE | WS_CHILD, 0, 0, 0, 0, m_PaintManager.GetPaintWindow(), (HMENU)0, NULL, NULL);
pUI->Attach(hWnd);
return pUI;
}
if (! strXML.IsEmpty())
{
CControlUI* pUI = builder.Create(strXML.GetData(), NULL, NULL, &m_PaintManager, NULL); // 这里必须传入m_PaintManager,不然子XML不能使用默认滚动条等信息。
return pUI;
}
return NULL;
}
示例8: xml
IMPL_LUA_FUNC(LuaCDialogBuilder, Create)
{
try
{
CDialogBuilder* self;
self = static_cast<CDialogBuilder*>(LuaStatic::CheckUserData(l, 1));
STRINGorID xml("");
if (lua_isnumber(l,2))
xml = STRINGorID(lua_tointeger(l, 2));
else{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);
xml = STRINGorID(pstrText.GetData());
}
CDuiString pType;
lua_op_t<CDuiString>::lua_to_value(l, 3, pType);
return 1;
}
catch (...)
{
DuiException(_T("LuaCDialogBuilder::Create"));
return 0;
}
}
示例9: Init
void CDateTimeWnd::Init(CDateTimeUI* pOwner)
{
m_pOwner = pOwner;
m_pOwner->m_nDTUpdateFlag = DT_NONE;
if (m_hWnd == NULL)
{
RECT rcPos = CalPos();
UINT uStyle =WS_CHILD|m_pOwner->m_dwStyle;// 修改者:YYM
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
//lxm,added,修改Date控件日期为横线
if(m_pOwner->m_dwStyle == DTS_SHORTDATECENTURYFORMAT || m_pOwner->m_dwStyle == DTS_SHORTDATEFORMAT)
{
CDuiString strFormat = _T("yyyy-MM-dd");
::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)strFormat.GetData());
}
}
if (m_pOwner->GetText().IsEmpty())
::GetLocalTime(&m_pOwner->m_sysTime);
::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&m_pOwner->m_sysTime);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
//
// SYSTEMTIME sysTimes[2];
// GetLocalTime(&(sysTimes[0]));
// DateTime_SetRange(m_hWnd,GDTR_MIN,sysTimes );
m_bInit = true;
}
示例10: ReadFile
BOOL CMP3Info::WriteID3V1(CDuiString strDestFile, BOOL bClear)
{
if (strDestFile == _T(""))
strDestFile = m_strFile;
HANDLE hFile = NULL;
if ((hFile = ::CreateFile(strDestFile.GetData(),GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,NULL)) != INVALID_HANDLE_VALUE)
{
// write the ID3
MP3ID3V1INFO sID3V1;
DWORD dwNumBytesReadWritten;
// first check if the ID3V1 exists in the file
if (SetFilePointer(hFile,-128,NULL,FILE_END) != INVALID_SET_FILE_POINTER
&& ReadFile(hFile,&sID3V1,128,&dwNumBytesReadWritten,NULL)
&& dwNumBytesReadWritten == 128
&& strncmp(sID3V1.Identify,("TAG"),3) == 0
)
SetFilePointer(hFile,-128,NULL,FILE_END); // tag exists, overwrite it
else
SetFilePointer(hFile,0,NULL,FILE_END); // tag doesnt exists
// write the ID3 tag (or clear it)
if (bClear)
SetEndOfFile(hFile);
else
{
memset(&sID3V1,0,sizeof(sID3V1));
memcpy(sID3V1.Identify,_T("TAG"),3);
memcpy(sID3V1.Title,m_strTitle.GetData(),min(m_strTitle.GetLength(),30));
memcpy(sID3V1.Artist,m_strArtist.GetData(),min(m_strArtist.GetLength(),30));
memcpy(sID3V1.Album,m_strAlbum.GetData(),min(m_strAlbum.GetLength(),30));
memcpy(sID3V1.Year,m_strYear.GetData(),min(m_strYear.GetLength(),4));
// NOTE: copying 30 bytes into sID3V1.comment will set reserved and tracknum
memcpy(sID3V1.Comment,m_strComment.GetData(),min(m_strComment.GetLength(), m_nTrack ? 28 : 30)); // if a track is specified, max length is 28, otherwise 30
if (m_nTrack)
sID3V1.Track = max(0,min(255,m_nTrack));
sID3V1.Genre = m_nGenre;
if (!WriteFile(hFile,&sID3V1,128,&dwNumBytesReadWritten,NULL) ||
dwNumBytesReadWritten != 128)
{
CloseHandle(hFile);
return FALSE;
}
}
CloseHandle(hFile);
}
else
return FALSE;
return TRUE;
}
示例11: SaveConfig
bool ConnInfoUI::SaveConfig( const std::string& path )
{
std::size_t theSize = m_dicServerInfo[kServerNameIndex].size();
//Json::Value serverConfig;
//Json::Value rootConfig;
FILE* fp = fopen(kConfigFilePath, "w+");
if (!fp) return false;
FileStream os(fp);
PrettyWriter<FileStream> writer(os);
writer.StartObject();
writer.String("Server");
writer.StartArray();
for (std::size_t idx=0; idx<theSize; ++idx)
{
writer.StartObject();
writer.String("name");
CDuiString name = Base::CharacterSet::ANSIToUnicode(m_dicServerInfo[kServerNameIndex][idx]).c_str();
writer.String(Base::CharacterSet::UnicodeToUTF8(name.GetData()).c_str());
writer.String("ip");
writer.String(m_dicServerInfo[kServerIpIndex][idx].c_str(), m_dicServerInfo[kServerIpIndex][idx].length());
writer.String("port");
writer.Int(atoi(m_dicServerInfo[kServerPortIndex][idx].c_str()));
writer.String("auth");
writer.String(m_dicServerInfo[kServerAuthIndex][idx].c_str());
writer.EndObject();
}
writer.EndArray();
writer.EndObject();
fclose(fp);
return true;
}
示例12: HandleMessage
LRESULT CHotKeyWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
else if( uMsg == OCM_COMMAND ) {
if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
RECT rcClient;
::GetClientRect(m_hWnd, &rcClient);
::InvalidateRect(m_hWnd, &rcClient, FALSE);
}
}
else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
m_pOwner->GetManager()->SendNotify(m_pOwner, _T("return"));
}
else if ( (uMsg == WM_NCACTIVATE) || (uMsg == WM_NCACTIVATE) || (uMsg == WM_NCCALCSIZE) )
{
return 0;
}
else if (uMsg == WM_PAINT)
{
PAINTSTRUCT ps = { 0 };
HDC hDC = ::BeginPaint(m_hWnd, &ps);
DWORD dwTextColor = m_pOwner->GetTextColor();
DWORD dwBkColor = m_pOwner->GetNativeBkColor();
CDuiString strText = GetHotKeyName();
::RECT rect;
::GetClientRect(m_hWnd, &rect);
::SetBkMode(hDC, TRANSPARENT);
::SetTextColor(hDC, RGB(GetBValue(dwTextColor), GetGValue(dwTextColor), GetRValue(dwTextColor)));
HBRUSH hBrush = CreateSolidBrush( RGB(GetBValue(dwBkColor), GetGValue(dwBkColor), GetRValue(dwBkColor)) );
::FillRect(hDC, &rect, hBrush);
::DeleteObject(hBrush);
HFONT hOldFont = (HFONT)SelectObject(hDC, GetWindowFont(m_hWnd));
::SIZE size = { 0 };
::GetTextExtentPoint32(hDC, strText.GetData(), strText.GetLength(), &size) ;
::DrawText(hDC, strText.GetData(), -1, &rect, DT_LEFT|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
::SelectObject(hDC, hOldFont);
::SetCaretPos(size.cx, 0);
::EndPaint(m_hWnd, &ps);
bHandled = TRUE;
}
else bHandled = FALSE;
if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
return lRes;
}
示例13: 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();
}
}
示例14: FindItem
int CDuiAutoComplete::FindItem(const CDuiString& rstr)
{
for (int i = 0; i < m_sStringArrayMap.GetSize(); i++)
if (m_sStringArrayMap.GetAt(i)->Compare(rstr.GetData()) == 0)
return i;
return -1;
}
示例15: SearchGo
void CMainWnd::SearchGo()
{
CDuiString sText = m_pSearchEdit->GetText();
if(!sText.IsEmpty()) {
CDuiString sUrl;
sUrl.Format(_T("https://www.baidu.com/s?ie=utf-8&wd=%s"), sText.GetData());
CreateNewTabAndGo(sUrl);
}
}