本文整理汇总了C++中StringW::length方法的典型用法代码示例。如果您正苦于以下问题:C++ StringW::length方法的具体用法?C++ StringW::length怎么用?C++ StringW::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringW
的用法示例。
在下文中一共展示了StringW::length方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
}
示例2: rho_wmsys_run_appW
void rho_wmsys_run_appW(const wchar_t* szPath, const wchar_t* szParams )
{
SHELLEXECUTEINFO se = {0};
se.cbSize = sizeof(SHELLEXECUTEINFO);
se.fMask = SEE_MASK_NOCLOSEPROCESS;
se.lpVerb = L"Open";
se.nShow = SW_SHOWNORMAL;
StringW strAppNameW = szPath;
for(int i = 0; i<(int)strAppNameW.length();i++)
{
if ( strAppNameW.at(i) == '/' )
strAppNameW.at(i) = '\\';
}
se.lpFile = strAppNameW.c_str();
if ( szParams && *szParams )
se.lpParameters = szParams;
if ( !ShellExecuteEx(&se) )
LOG(ERROR) + "Cannot execute: " + strAppNameW + ";Error: " + GetLastError();
if(se.hProcess)
CloseHandle(se.hProcess);
}
示例3: 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);
}
示例4: selectPicture
HRESULT Camera::selectPicture(HWND hwndOwner,LPTSTR pszFilename)
{
RHO_ASSERT(pszFilename);
#if defined( _WIN32_WCE ) && !defined( OS_PLATFORM_MOTCE )
OPENFILENAMEEX ofn = {0};
#else
OPENFILENAME ofn = {0};
#endif
pszFilename[0] = 0;
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFilter = NULL;
ofn.lpstrFile = pszFilename;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = _T("Select an image");
#if defined( _WIN32_WCE ) && !defined( OS_PLATFORM_MOTCE )
ofn.ExFlags = OFN_EXFLAG_THUMBNAILVIEW|OFN_EXFLAG_NOFILECREATE|OFN_EXFLAG_LOCKDIRECTORY;
if (GetOpenFileNameEx(&ofn))
#else
if (GetOpenFileName(&ofn))
#endif
{
HRESULT hResult = S_OK;
/*
TCHAR rhoroot[MAX_PATH];
wchar_t* root = wce_mbtowc(rho_rhodesapp_getblobsdirpath());
wsprintf(rhoroot,L"%s",root);
free(root);
create_folder(rhoroot);*/
StringW strBlobRoot = convertToStringW( RHODESAPP().getBlobsDirPath() );
LPCTSTR szExt = wcsrchr(pszFilename, '.');
TCHAR filename[256];
generate_filename(filename, szExt);
int len = strBlobRoot.length() + wcslen(L"\\") + wcslen(filename);
wchar_t* full_name = (wchar_t*) malloc((len+2)*sizeof(wchar_t));
wsprintf(full_name,L"%s\\%s",strBlobRoot.c_str(),filename);
if (copy_file(pszFilename,full_name))
{
wcscpy( pszFilename, filename );
} else {
hResult = E_INVALIDARG;
}
free(full_name);
return hResult;
} else if (GetLastError()==ERROR_SUCCESS) {
return S_FALSE; //user cancel op
}
return E_INVALIDARG;
}
示例5: rho_sys_run_app
void rho_sys_run_app(const char *appname, VALUE params)
{
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"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;
CFilePath oPath(appname);
convertToStringW(oPath.getBaseName(), strBaseName);
strFullPath += strBaseName;
StringW strParamsW;
if ( params && !rho_ruby_is_NIL(params) )
{
convertToStringW(getStringFromValue(params), strParamsW);
}
rho_wmsys_run_appW(strFullPath.c_str(), strParamsW.c_str());
}
}
}
示例6: funct
/*static*/ unsigned int CRhoFile::deleteFolder(const char* szFolderPath)
{
#if defined(WINDOWS_PLATFORM) && !defined(OS_WP8)
StringW swPath;
convertToStringW(szFolderPath, swPath);
wchar_t* name = new wchar_t[ swPath.length() + 2];
swprintf(name, L"%s%c", swPath.c_str(), '\0');
translate_wchar(name, L'/', L'\\');
SHFILEOPSTRUCTW fop = {0};
fop.hwnd = NULL;
fop.wFunc = FO_DELETE;
fop.pFrom = name;
fop.pTo = NULL;
fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR
#if defined(OS_WINDOWS_DESKTOP) || defined(OS_PLATFORM_MOTCE)
| FOF_NOERRORUI
#endif
;
int result = SHFileOperationW(&fop);
delete name;
return result == 0 ? 0 : (unsigned int)-1;
#elif defined(OS_WP8)
StringW swPath;
convertToStringW(szFolderPath, swPath);
recursiveDeleteDirectory(swPath);
return 0;
#elif defined (OS_ANDROID)
RemoveFileFunctor funct(szFolderPath);
return funct("");
#else
rho_file_impl_delete_folder(szFolderPath);
return 0;
#endif
}