本文整理汇总了C++中StringW类的典型用法代码示例。如果您正苦于以下问题:C++ StringW类的具体用法?C++ StringW怎么用?C++ StringW使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringW类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RHODESAPP
LRESULT CMainWindow::OnAlertShowPopup (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
//LOG(INFO) + __FUNCTION__;
StringW strAppName = RHODESAPP().getAppNameW();
CAlertDialog::Params *params = (CAlertDialog::Params *)lParam;
if (params->m_dlgType == CAlertDialog::Params::DLG_STATUS)
{
m_SyncStatusDlg.setStatusText(convertToStringW(params->m_message).c_str());
m_SyncStatusDlg.setTitle( convertToStringW(params->m_title).c_str() );
if ( !m_SyncStatusDlg.m_hWnd )
m_SyncStatusDlg.Create(m_hWnd, 0);
else
{
m_SyncStatusDlg.ShowWindow(SW_SHOW);
m_SyncStatusDlg.BringWindowToTop();
}
}else if (params->m_dlgType == CAlertDialog::Params::DLG_DEFAULT) {
MessageBox(convertToStringW(params->m_message).c_str(), strAppName.c_str(), MB_ICONWARNING | MB_OK);
RHODESAPP().callPopupCallback(params->m_callback, "ok", "ok");
} else if (params->m_dlgType == CAlertDialog::Params::DLG_CUSTOM)
{
if ( params->m_buttons.size() == 1 && strcasecmp(params->m_buttons[0].m_strCaption.c_str(), "ok") == 0)
{
MessageBox(convertToStringW(params->m_message).c_str(), convertToStringW(params->m_title).c_str(), MB_ICONWARNING | MB_OK);
RHODESAPP().callPopupCallback(params->m_callback, params->m_buttons[0].m_strID, params->m_buttons[0].m_strCaption);
}
else if (params->m_buttons.size() == 2 && strcasecmp(params->m_buttons[0].m_strCaption.c_str(), "ok") == 0 &&
strcasecmp(params->m_buttons[1].m_strCaption.c_str(), "cancel") == 0)
{
int nRes = MessageBox(convertToStringW(params->m_message).c_str(), convertToStringW(params->m_title).c_str(),
MB_ICONWARNING | MB_OKCANCEL);
int nBtn = nRes == IDCANCEL ? 1 : 0;
RHODESAPP().callPopupCallback(params->m_callback, params->m_buttons[nBtn].m_strID, params->m_buttons[nBtn].m_strCaption);
}
else
{
if (m_alertDialog == NULL)
{
m_alertDialog = new CAlertDialog(params);
m_alertDialog->DoModal();
delete m_alertDialog;
m_alertDialog = NULL;
} else {
LOG(WARNING) + "Trying to show alert dialog while it exists.";
}
}
}
delete params;
return 0;
}
示例2: defined
HRESULT Camera::takePicture(HWND hwndOwner,LPTSTR pszFilename)
{
HRESULT hResult = S_OK;
#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
SHCAMERACAPTURE shcc;
StringW root;
convertToStringW(rho_rhodesapp_getblobsdirpath(), root);
wsprintf( pszFilename, L"%s", root.c_str() );
create_folder(pszFilename);
//LPCTSTR szExt = wcsrchr(pszFilename, '.');
TCHAR filename[256];
generate_filename(filename,L".jpg");
// Set the SHCAMERACAPTURE structure.
ZeroMemory(&shcc, sizeof(shcc));
shcc.cbSize = sizeof(shcc);
shcc.hwndOwner = hwndOwner;
shcc.pszInitialDir = pszFilename;
shcc.pszDefaultFileName = filename;
shcc.pszTitle = TEXT("Camera");
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_MESSAGING;
shcc.nResolutionWidth = 176;
shcc.nResolutionHeight = 144;
shcc.nVideoTimeLimit = 15;
shcc.Mode = CAMERACAPTURE_MODE_STILL;
// Display the Camera Capture dialog.
hResult = SHCameraCapture(&shcc);
// The next statements will execute only after the user takes
// a picture or video, or closes the Camera Capture dialog.
if (S_OK == hResult) {
LPTSTR fname = get_file_name(shcc.szFile,pszFilename);
if (fname) {
StringCchCopy(pszFilename, MAX_PATH, fname);
free(fname);
} else {
LOG(ERROR) + "takePicture error get file: " + shcc.szFile;
hResult = E_INVALIDARG;
}
}else
{
LOG(ERROR) + "takePicture failed with code: " + LOGFMT("0x%X") + hResult;
}
#endif //_WIN32_WCE
return hResult;
}
示例3: convertToStringW
LPTSTR Camera::get_file_name(LPCTSTR from, LPCTSTR to)
{
int len;
StringW destinationString = convertToStringW(from);
size_t found;
len = destinationString.find_last_of('\\');
LOG(INFO) + "Test Check: " + len;
StringW name = destinationString.substr(len+1);
int length1 = wcslen(name.c_str());
wchar_t* returnName = (wchar_t*) malloc(length1*sizeof(wchar_t)+1);
wcscpy(returnName,name.c_str());
len = wcslen(to);
if (wcsncmp( to, from, len )!=0)
{
StringW strPathTo = to;
strPathTo += L"\\";
strPathTo += name;
if ( !copy_file( from, strPathTo.c_str() ) )
return 0;
}
if (wcsncmp( to, from, len )!=0)
{
if( DeleteFile(from) != 0 )
LOG(INFO) + "File Deletion Failed " ;
else
LOG(INFO) + "File Deleted Successfull " ;
}
return returnName;
}
示例4: rho_sys_app_uninstall
void rho_sys_app_uninstall(const char *appname)
{
#ifdef OS_WINDOWS_DESKTOP
CRegKey oKey;
StringW strKeyPath;
LONG res = openRegAppPath(appname, oKey, strKeyPath);
if ( res != ERROR_SUCCESS )
{
LOG(ERROR) + "Cannot open registry key: " + strKeyPath + "; Code:" + res;
} else
{
TCHAR szBuf[MAX_PATH+1];
ULONG nChars = MAX_PATH;
res = oKey.QueryStringValue(L"Uninstaller", szBuf, &nChars);
if ( res != ERROR_SUCCESS )
LOG(ERROR) + "Cannot read registry key: Uninstaller; Code:" + res;
else
{
StringW strFullPath = szBuf;
rho_wmsys_run_appW( strFullPath.c_str(), L"" );
}
}
#else
CFilePath oPath(appname);
String strAppName = oPath.getFolderName();
StringW strRequest =
L"<wap-provisioningdoc><characteristic type=\"UnInstall\">"
L"<characteristic type=\"";
strRequest += convertToStringW(strAppName) + L"\">"
L"<parm name=\"uninstall\" value=\"1\"/>"
L"</characteristic>"
L"</characteristic></wap-provisioningdoc>";
#if defined( OS_WINCE )&& !defined( OS_PLATFORM_MOTCE )
HRESULT hr = E_FAIL;
LPWSTR wszOutput = NULL;
hr = DMProcessConfigXML(strRequest.c_str(), CFGFLAG_PROCESS, &wszOutput);
if (FAILED(hr) || !wszOutput )
LOG(ERROR) + "DMProcessConfigXML failed: " + hr;
else
{
}
if ( wszOutput )
free( wszOutput );
#endif
#endif
}
示例5: rho_sys_run_app
void rho_sys_run_app(const char *appname, VALUE params)
{
CFilePath oPath(appname);
String strAppName = oPath.getFolderName();
StringW strKeyPath = L"Software\\Apps\\";
strKeyPath += convertToStringW(strAppName);
StringW strParamsW;
if ( params && !rho_ruby_is_NIL(params) )
{
convertToStringW(getStringFromValue(params), strParamsW);
/*
int nPos = strParamsW.find(L"rhogallery_app");
if ( nPos >= 0 )
{
if ( nPos == 0 || (nPos > 0 && strParamsW.at(nPos-1)!= '-' ) )
strParamsW.insert(nPos, L"-");
}
*/
strParamsW.insert(0, L"-RhoStartParams:");
}
CRegKey oKey;
LONG res = oKey.Open(HKEY_LOCAL_MACHINE, strKeyPath.c_str(), KEY_READ);
if ( res != ERROR_SUCCESS )
{
LOG(ERROR) + "Cannot open registry key: " + strKeyPath + "; Code:" + res;
}else
{
TCHAR szBuf[256];
ULONG nChars = 255;
res = oKey.QueryStringValue(L"InstallDir", szBuf, &nChars );
if ( res != ERROR_SUCCESS )
LOG(ERROR) + "Cannot read registry key: InstallDir; Code:" + res;
else
{
StringW strFullPath = szBuf;
if ( strFullPath[strFullPath.length()-1] != '/' && strFullPath[strFullPath.length()-1] != '\\' )
strFullPath += L"\\";
StringW strBaseName;
convertToStringW(oPath.getBaseName(), strBaseName);
strFullPath += strBaseName;
rho_wmsys_run_appW(strFullPath.c_str(), strParamsW.c_str());
}
}
}
示例6: rho_wmimpl_draw_splash_screen
extern "C" LRESULT rho_wmimpl_draw_splash_screen(HWND hWnd)
{
LOG(INFO) + "PAINT";
CSplashScreen& splash = RHODESAPP().getSplashScreen();
splash.start();
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
StringW pathW = convertToStringW(RHODESAPP().getLoadingPngPath());
HBITMAP hbitmap = SHLoadImageFile(pathW.c_str());
if (hbitmap)
{
BITMAP bmp;
GetObject(hbitmap, sizeof(bmp), &bmp);
RECT rcClient;
GetClientRect(hWnd, &rcClient);
CDC hdcMem = CreateCompatibleDC(hDC);
hdcMem.FillSolidRect(&rcClient, RGB(255,255,255));
HGDIOBJ resObj = SelectObject(hdcMem, hbitmap);
int nLeft = rcClient.left, nTop=rcClient.top, nWidth = bmp.bmWidth, nHeight=bmp.bmHeight, Width = rcClient.right - rcClient.left, Height = rcClient.bottom - rcClient.top;
if (splash.isFlag(CSplashScreen::HCENTER) )
nLeft = (Width-nWidth)/2;
if (splash.isFlag(CSplashScreen::VCENTER) )
nTop = (Height-nHeight)/2;
if (splash.isFlag(CSplashScreen::VZOOM) )
nHeight = Height;
if (splash.isFlag(CSplashScreen::HZOOM) )
nWidth = Width;
StretchBlt(hDC, nLeft, nTop, nWidth, nHeight,
hdcMem, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
//BitBlt(hDC, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, resObj);
DeleteObject(hbitmap);
//DeleteObject(hdcMem);
}
EndPaint(hWnd, &ps);
return 1;
}
示例7: copyFolder
static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boolean bMove)
{
unsigned int nErr = 0;
CRhoFile::createFolder(convertToStringA(strDst).c_str());
StringW wFolderMask = CFilePath::join(strSrc, L"*");
WIN32_FIND_DATAW FindFileData = {0};
HANDLE hFind = INVALID_HANDLE_VALUE;
#if defined(OS_WP8)
hFind = FindFirstFileExW(wFolderMask.c_str(), FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_CASE_SENSITIVE);
#else
hFind = FindFirstFileW(wFolderMask.c_str(), &FindFileData);
#endif
if (hFind == INVALID_HANDLE_VALUE)
return GetLastError();
do{
if (!wcscmp(FindFileData.cFileName , L".")) continue ;
if (!wcscmp(FindFileData.cFileName , L"..")) continue ;
if ( FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY )
{
int i = 0;
nErr = copyFolder( CFilePath::join(strSrc,FindFileData.cFileName), CFilePath::join(strDst,FindFileData.cFileName), bMove );
}
else
{
if ( bMove )
{
CRhoFile::deleteFile(convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
nErr = CRhoFile::renameFile(convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
}
else
nErr = CRhoFile::copyFile( convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str() );
}
if ( nErr != 0 )
return nErr;
}while (FindNextFileW(hFind, &FindFileData) != 0);
FindClose(hFind);
return 0;
}
示例8: VERIFY
void CMainWindow::createCustomMenu()
{
CMenu menu;
CMenu sub;
CMenu popup;
if (!m_pBrowserEng->GetHTMLWND())
return;
VERIFY(menu.CreateMenu());
VERIFY(popup.CreatePopupMenu());
menu.AppendMenu(MF_POPUP, (UINT) popup.m_hMenu, _T(""));
RHODESAPP().getAppMenu().copyMenuItems(m_arAppMenuItems);
#ifdef ENABLE_DYNAMIC_RHOBUNDLE
String strIndexPage = CFilePath::join(RHODESAPP().getStartUrl(),"index"RHO_ERB_EXT);
if ( RHODESAPP().getCurrentUrl().compare(RHODESAPP().getStartUrl()) == 0 ||
RHODESAPP().getCurrentUrl().compare(strIndexPage) == 0 )
m_arAppMenuItems.addElement(CAppMenuItem("Reload RhoBundle","reload_rhobundle"));
#endif //ENABLE_DYNAMIC_RHOBUNDLE
//update UI with custom menu items
USES_CONVERSION;
for ( int i = m_arAppMenuItems.size() - 1; i >= 0; i--)
{
CAppMenuItem& oItem = m_arAppMenuItems.elementAt(i);
if (oItem.m_eType == CAppMenuItem::emtSeparator)
popup.InsertMenu(0, MF_BYPOSITION | MF_SEPARATOR, (UINT_PTR)0, (LPCTSTR)0);
else
{
StringW strLabelW = convertToStringW(oItem.m_strLabel);
popup.InsertMenu(0, MF_BYPOSITION, ID_CUSTOM_MENU_ITEM_FIRST + i,
oItem.m_eType == CAppMenuItem::emtClose ? _T("Exit") : strLabelW.c_str() );
}
}
RECT rect;
GetWindowRect(&rect);
rect.bottom -= m_menuBarHeight;
sub.Attach(menu.GetSubMenu(0));
sub.TrackPopupMenu( TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON | TPM_VERNEGANIMATION,
rect.right-1,
rect.bottom-1,
m_hWnd);
sub.Detach();
}
示例9: _init
void Application::_init(const StringW& appType)
{
_uiEngine = NULL;
if (appType.startsWith(Ascii8("UI")))
{
#if defined(FOG_BUILD_UI)
// Create the UIEngine by name.
_uiEngine = createUIEngine(appType);
#else
Logger::warning("Fog::Application", "_init",
"Requested to create UI based application, but Fog/UI was disabled at compile-time.");
#endif
}
EventLoopImpl* eventLoopImpl = NULL;
#if defined(FOG_BUILD_UI)
if (_uiEngine != NULL)
eventLoopImpl = _uiEngine->_eventLoop._d->addRef();
#endif // FOG_BUILD_UI
// Create EventLoop by of the required type.
if (eventLoopImpl == NULL)
eventLoopImpl = createEventLoop(appType);
if (eventLoopImpl != NULL)
_homeThread->_eventLoop.adopt(eventLoopImpl);
// Set global application instance (singleton).
if (_instance == NULL)
_instance = this;
}
示例10: convertToStringW
void CRhodesModule::createAutoStartShortcut()
{
#ifdef OS_WINCE
StringW strLnk = L"\\Windows\\StartUp\\";
strLnk += convertToStringW(getAppName());
strLnk += L".lnk";
StringW strAppPath = L"\"";
char rootpath[MAX_PATH];
GetModuleFileNameA(NULL,rootpath,MAX_PATH);
strAppPath += convertToStringW(rootpath);
strAppPath += L"\" -minimized";
DWORD dwRes = SHCreateShortcut( (LPTSTR)strLnk.c_str(), (LPTSTR)strAppPath.c_str());
#endif
}
示例11: GetIDsOfNames
STDMETHODIMP ScriptObject::GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispID) {
//USES_CONVERSION;
for (UINT n = 0; n < cNames; n++) {
StringW strName = rgszNames[n];
List<SCRIPT_OBJECT_METHOD_TABLE>::Iterator iter = _methodTable.GetHeadPosition();
while (_methodTable.iteratorValid(iter)) {
if (strName.Compare(iter->name) == 0) {
rgDispID[n] = iter->dispid;
break;
}
iter++;
}
if (!_methodTable.iteratorValid(iter)) return E_UNEXPECTED;
}
return S_OK;
}
示例12: retval
/*
* vislib::sys::Path::Concatenate
*/
vislib::StringW vislib::sys::Path::Concatenate(const StringW& lhs,
const StringW& rhs, const bool canonicalise) {
StringW retval(lhs);
if (lhs.EndsWith(SEPARATOR_W) && rhs.StartsWith(SEPARATOR_W)) {
retval.Append(rhs.PeekBuffer() + 1);
} else if (!lhs.EndsWith(SEPARATOR_W) && !rhs.StartsWith(SEPARATOR_W)) {
retval.Append(SEPARATOR_W);
retval.Append(rhs);
} else {
retval.Append(rhs);
}
return canonicalise ? Path::Canonicalise(retval) : retval;
}
示例13: RHO_MAP_TRACE2
void DrawingContextImpl::drawText(int x, int y, int nWidth, int nHeight, String const &text, int color) {
RHO_MAP_TRACE2("DrawingContext drawText with x = %d, y = %d", x, y);
HFONT hfontTahoma;
LOGFONT logfont;
HFONT hfontSave = NULL;
memset (&logfont, 0, sizeof (logfont));
logfont.lfHeight = 18;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfWeight = FW_BOLD;
logfont.lfItalic = FALSE;
logfont.lfUnderline = FALSE;
logfont.lfStrikeOut = FALSE;
logfont.lfCharSet = DEFAULT_CHARSET;
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logfont.lfQuality = DEFAULT_QUALITY;
logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
_tcsncpy (logfont.lfFaceName, TEXT("Tahoma"), LF_FACESIZE);
logfont.lfFaceName[LF_FACESIZE-1] = TEXT('\0'); // Ensure null termination
hfontTahoma = CreateFontIndirect (&logfont);
if (hfontTahoma) {
hfontSave = (HFONT) SelectObject(mHDC, hfontTahoma);
}
StringW pathW = convertToStringW(text);
SetBkMode(mHDC, TRANSPARENT);
SetTextColor(mHDC, color & 0xFFFFFF);
//TextOut(mHDC, x, y, pathW.c_str(), pathW.length());
RECT r;
r.left = x;
r.top = y;
r.right = x+nWidth;
r.bottom = y + nHeight;
DrawText(mHDC, pathW.c_str(), -1, &r, DT_LEFT | DT_TOP);
if (hfontTahoma) {
SelectObject(mHDC, hfontSave);
DeleteObject (hfontTahoma);
}
}
示例14: rho_wmsys_run_app
void rho_wmsys_run_app(const char* szPath, const char* szParams )
{
SHELLEXECUTEINFO se = {0};
se.cbSize = sizeof(SHELLEXECUTEINFO);
se.fMask = SEE_MASK_NOCLOSEPROCESS;
se.lpVerb = L"Open";
StringW strAppNameW;
convertToStringW(szPath, strAppNameW);
for(int i = 0; i<(int)strAppNameW.length();i++)
{
if ( strAppNameW.at(i) == '/' )
strAppNameW.at(i) = '\\';
}
se.lpFile = strAppNameW.c_str();
StringW strParamsW;
if ( szParams && *szParams )
{
convertToStringW(szParams, strParamsW);
se.lpParameters = strParamsW.c_str();
}
ShellExecuteEx(&se);
}
示例15: rho_webview_execute_js
const char* rho_webview_execute_js(const char* js, int index)
{
// String strJS = "javascript:";
//strJS += js;
//RAWTRACEC1("Execute JS: %s", js);
//rho_webview_navigate(strJS.c_str(), index);
StringW strJsW;
convertToStringW(js, strJsW);
TNavigateData* nd = new TNavigateData();
nd->index = index;
nd->url = _tcsdup(strJsW.c_str());
::PostMessage( getMainWnd(), WM_COMMAND, IDM_EXECUTEJS, (LPARAM)nd );
return "";
}