当前位置: 首页>>代码示例>>C++>>正文


C++ StringW::c_str方法代码示例

本文整理汇总了C++中StringW::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ StringW::c_str方法的具体用法?C++ StringW::c_str怎么用?C++ StringW::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringW的用法示例。


在下文中一共展示了StringW::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadLoadingHtml

BSTR loadLoadingHtml()
{
	rho::String fname = RHODESAPP().getLoadingPagePath();

	size_t pos = fname.find("file://");
	if (pos == 0 && pos != std::string::npos)
		fname.erase(0, 7);

    CRhoFile oFile;
    StringW strTextW;
    if ( oFile.open( fname.c_str(), common::CRhoFile::OpenReadOnly) )
        oFile.readStringW(strTextW);
    else
    {
		LOG(ERROR) + "failed to open loading page \"" + fname + "\"";
		strTextW = L"<html><head><title>Loading...</title></head><body><h1>Loading...</h1></body></html>";
    }

    return SysAllocString(strTextW.c_str());
}
开发者ID:insphereapplication,项目名称:rhodes,代码行数:20,代码来源:MainWindow.cpp

示例2: OnExecuteJS

LRESULT CMainWindow::OnExecuteJS(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& /*bHandled*/)
{
    TNavigateData* nd = (TNavigateData*)hWndCtl;
    if (nd) {
        LPTSTR wcurl = (LPTSTR)(nd->url);
        if (wcurl) {

            StringW strUrlW;
            if(_memicmp(wcurl,L"JavaScript:",11*2) != 0)
                strUrlW = L"javascript:";

            strUrlW += wcurl;

            Navigate2((LPWSTR)strUrlW.c_str(), nd->index);
            free(wcurl);
        }
        free(nd);
    }
    return 0;
}
开发者ID:mcaloon,项目名称:rhodes,代码行数:20,代码来源:MainWindowQt.cpp

示例3: 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
}
开发者ID:KlearXos,项目名称:rhodes,代码行数:41,代码来源:RhoFile.cpp

示例4: RemoveFolder

bool CAppManager::RemoveFolder(String pathname)
{
	if (pathname.length() > 0) 
    {
		StringW  swPath = convertToStringW(pathname);
		TCHAR name[MAX_PATH+2];
        wsprintf(name, L"%s%c", swPath.c_str(), '\0');

		SHFILEOPSTRUCT fop;

		fop.hwnd = NULL;
		fop.wFunc = FO_DELETE;		
		fop.pFrom = name;
		fop.pTo = NULL;
		fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
		int result = SHFileOperation(&fop);

		return result == 0;
	}
	return false;
}
开发者ID:Aerodynamic,项目名称:rhodes,代码行数:21,代码来源:AppManager.cpp

示例5: ShowLoadingPage

void CMainWindow::ShowLoadingPage()
{
	String fname = RHODESAPP().getLoadingPagePath();

	size_t pos = fname.find("file://");
	if (pos == 0 && pos != std::string::npos)
		fname.erase(0, 7);

    CRhoFile oFile;
    StringW strTextW;
    if ( oFile.open( fname.c_str(), common::CRhoFile::OpenReadOnly) )
        oFile.readStringW(strTextW);
    else
    {
		LOG(ERROR) + "failed to open loading page \"" + fname + "\"";
		strTextW = L"<html><head><title>Loading...</title></head><body><h1>Loading...</h1></body></html>";
    }

    if ( m_pBrowserEng )
        m_pBrowserEng->NavigateToHtml(strTextW.c_str());
}
开发者ID:polydectes,项目名称:rhodes,代码行数:21,代码来源:MainWindow.cpp

示例6: rho_sys_app_install

void rho_sys_app_install(const char *url)
{
#ifdef OS_WINDOWS_DESKTOP
	String sUrl = url;
    CFilePath oFile(sUrl);
	String filename = RHODESAPP().getRhoUserPath()+ oFile.getBaseName();
	if (CRhoFile::isFileExist(filename.c_str()) && (CRhoFile::deleteFile(filename.c_str()) != 0)) {
		LOG(ERROR) + "rho_sys_app_install() file delete failed: " + filename;
	} else {
		NetRequest NetRequest;
		NetResponse resp = getNetRequest(&NetRequest).pullFile(sUrl, filename, NULL, NULL);
		if (resp.isOK()) {
			StringW filenameW = convertToStringW(filename);
			LOG(INFO) + "Downloaded " + sUrl + " to " + filename;
			rho_wmsys_run_appW(filenameW.c_str(), L"");
		} else {
			LOG(ERROR) + "rho_sys_app_install() download failed: " + sUrl;
		}
	}
#else
    rho_sys_open_url(url);
#endif
}
开发者ID:stevez,项目名称:rhodes,代码行数:23,代码来源:SystemImpl.cpp

示例7: createCustomMenu

void CMainWindow::createCustomMenu()
{
	HMENU hMenu = (HMENU)m_menuBar.SendMessage(SHCMBM_GETSUBMENU, 0, IDM_SK2_MENU);
	
	//except exit item
	int num = GetMenuItemCount (hMenu);
	for (int i = 0; i < (num - 1); i++)	
		DeleteMenu(hMenu, 0, MF_BYPOSITION);

	RHODESAPP().getAppMenu().copyMenuItems(m_arAppMenuItems);
 	
	//update UI with cusom menu items
	USES_CONVERSION;
    for ( int i = m_arAppMenuItems.size() - 1; i >= 0; i--)
    {
        CAppMenuItem& oItem = m_arAppMenuItems.elementAt(i);
        StringW strLabelW = convertToStringW(oItem.m_strLabel);

		if (oItem.m_eType == CAppMenuItem::emtSeparator) 
			InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
		else if (oItem.m_eType != CAppMenuItem::emtExit && oItem.m_eType != CAppMenuItem::emtClose)
    		InsertMenu(hMenu, 0, MF_BYPOSITION, ID_CUSTOM_MENU_ITEM_FIRST + i, strLabelW.c_str() );
	}
}
开发者ID:Aerodynamic,项目名称:rhodes,代码行数:24,代码来源:MainWindow.cpp

示例8: 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";

    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); 
}
开发者ID:manishasarkar,项目名称:rhodes,代码行数:24,代码来源:SystemImpl.cpp

示例9: LOG

extern "C" void rho_wm_impl_CheckLicense()
{   
    int nRes = 0;
    LOG(INFO) + "Start license_rc.dll";
    HINSTANCE hLicenseInstance = LoadLibrary(L"license_rc.dll");
    LOG(INFO) + "Stop license_rc.dll";
    

    if(hLicenseInstance)
    {
#ifdef OS_WINDOWS_DESKTOP
        PCL pCheckLicense = (PCL) ::GetProcAddress(hLicenseInstance, "[email protected]");
        FUNC_IsLicenseOK pIsOK = (FUNC_IsLicenseOK) ::GetProcAddress(hLicenseInstance, "[email protected]");
#else
        PCL pCheckLicense = (PCL) GetProcAddress(hLicenseInstance, L"CheckLicense");
        FUNC_IsLicenseOK pIsOK = (FUNC_IsLicenseOK) GetProcAddress(hLicenseInstance, L"IsLicenseOK");
#endif
        LPCWSTR szLogText = 0;
        if(pCheckLicense)
        {
            StringW strLicenseW;
            common::convertToStringW( get_app_build_config_item("motorola_license"), strLicenseW );

            StringW strCompanyW;
            common::convertToStringW( get_app_build_config_item("motorola_license_company"), strCompanyW );

        #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME)
            LPCTSTR szLicense = rho_wmimpl_sharedconfig_getvalue( L"LicenseKey" );
            if ( szLicense )
                strLicenseW = szLicense;

            LPCTSTR szLicenseComp = rho_wmimpl_sharedconfig_getvalue( L"LicenseKeyCompany" );
            if ( szLicenseComp )
                strCompanyW = szLicenseComp;
        #endif

            StringW strAppNameW;
            strAppNameW = RHODESAPP().getAppNameW();
            szLogText = pCheckLicense( getMainWnd(), strAppNameW.c_str(), strLicenseW.c_str(), strCompanyW.c_str() );
        }

        if ( szLogText && *szLogText )
            LOGC(INFO, "License") + szLogText;

        nRes = pIsOK ? pIsOK() : 0;
    }

#ifdef APP_BUILD_CAPABILITY_MOTOROLA
    if ( nRes == 0 )
    {
        rho_wm_impl_CheckLicenseWithBarcode(getMainWnd(),hLicenseInstance);
        return;
    }
#endif

#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
    if ( nRes )
    {
        FUNC_GetAppLicenseObj pGetAppLicenseObj = (FUNC_GetAppLicenseObj) GetProcAddress(hLicenseInstance, L"GetAppLicenseObj");
        if ( pGetAppLicenseObj )
            rho_wm_impl_SetApplicationLicenseObj( pGetAppLicenseObj() );
    }
#endif

    if ( !nRes )
        ::PostMessage( getMainWnd(), WM_SHOW_LICENSE_WARNING, 0, 0);
}
开发者ID:parrotbait,项目名称:rhodes,代码行数:67,代码来源:Rhodes.cpp

示例10: PreMessageLoop

// This method is called immediately before entering the message loop.
// It contains initialization code for the application.
// Returns:
// S_OK => Success. Continue with RunMessageLoop() and PostMessageLoop().
// S_FALSE => Skip RunMessageLoop(), call PostMessageLoop().
// error code => Failure. Skip both RunMessageLoop() and PostMessageLoop().
HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
{
    HRESULT hr = __super::PreMessageLoop(nShowCmd);
    if (FAILED(hr))
    {
        return hr;
    }
    // Note: In this sample, we don't respond differently to different hr success codes.

#if !defined(OS_WINDOWS_DESKTOP)
    SetLastError(0);
    HANDLE hEvent = CreateEvent( NULL, false, false, CMainWindow::GetWndClassInfo().m_wc.lpszClassName );

    if ( !m_bRestarting && hEvent != NULL && GetLastError() == ERROR_ALREADY_EXISTS)
    {
        // Rho Running so could bring to foreground
        HWND hWnd = FindWindow(CMainWindow::GetWndClassInfo().m_wc.lpszClassName, NULL);

        if (hWnd)
        {
            ShowWindow(hWnd, SW_SHOW);
            SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
            SetForegroundWindow( hWnd );

            COPYDATASTRUCT cds = {0};
            cds.cbData = m_strTabName.length()+1;
            cds.lpData = (char*)m_strTabName.c_str();
            SendMessage( hWnd, WM_COPYDATA, (WPARAM)WM_WINDOW_SWITCHTAB, (LPARAM)(LPVOID)&cds);
        }

        return S_FALSE;
    }
#endif

    if ( !rho_sys_check_rollback_bundle(rho_native_rhopath()) )
    {
        rho_sys_impl_exit_with_errormessage( "Bundle update", "Application is corrupted. Reinstall it, please.");
        return S_FALSE;
    }

#if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME)
    rho_logconf_Init((rho_wmimpl_get_logpath()[0]==0 ? m_strRootPath.c_str() : rho_wmimpl_get_logpath()), m_strRootPath.c_str(), m_logPort.c_str());
    if (rho_wmimpl_get_logurl()[0]!=0)
        LOGCONF().setLogURL(rho_wmimpl_get_logurl());
    if (rho_wmimpl_get_logmaxsize())
        LOGCONF().setMaxLogFileSize(*rho_wmimpl_get_logmaxsize());
    if (rho_wmimpl_get_loglevel())
        LOGCONF().setMinSeverity(*rho_wmimpl_get_loglevel());
    if (rho_wmimpl_get_fullscreen())
        RHOCONF().setBool("full_screen", true, false);
    if (rho_wmimpl_get_logmemperiod())
        LOGCONF().setCollectMemoryInfoInterval(*rho_wmimpl_get_logmemperiod());
#else
    rho_logconf_Init(m_strRootPath.c_str(), m_strRootPath.c_str(), m_logPort.c_str());
#endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME

    LOGCONF().setMemoryInfoCollector(CLogMemory::getInstance());

#ifdef RHODES_EMULATOR
    RHOSIMCONF().setAppConfFilePath(CFilePath::join( m_strRootPath, RHO_EMULATOR_DIR"/rhosimconfig.txt").c_str());
    RHOSIMCONF().loadFromFile();
    if ( m_strRhodesPath.length() > 0 )
        RHOSIMCONF().setString("rhodes_path", m_strRhodesPath, false );
    RHOCONF().setString("rhosim_platform", RHOSIMCONF().getString("platform"), false);
    RHOCONF().setString("app_version", RHOSIMCONF().getString("app_version"), false);
	String start_path = RHOSIMCONF().getString("start_path");
    if ( start_path.length() > 0 )
	    RHOCONF().setString("start_path", start_path, false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/debugger;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/uri;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/timeout;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/digest;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/openssl;"), false);
#endif

    if ( !rho_rhodesapp_canstartapp(g_strCmdLine.c_str(), " /-,") )
    {
		LOG(INFO) + "This is hidden app and can be started only with security key.";
		if (RHOCONF().getString("invalid_security_token_start_path").length() <= 0)
        {
#ifdef OS_WINDOWS_DESKTOP
	    ::MessageBoxW(0, L"This is hidden app and can be started only with security key.", L"Security Token Verification Failed", MB_ICONERROR | MB_OK);
#endif
			return S_FALSE;
        }
    }

	LOG(INFO) + "Rhodes started";
#ifdef OS_WINDOWS_DESKTOP
	if (m_strHttpProxy.length() > 0) {
		parseHttpProxyURI(m_strHttpProxy);
	} else
#endif
	{
//.........这里部分代码省略.........
开发者ID:parrotbait,项目名称:rhodes,代码行数:101,代码来源:Rhodes.cpp

示例11: PreMessageLoop

// This method is called immediately before entering the message loop.
// It contains initialization code for the application.
// Returns:
// S_OK => Success. Continue with RunMessageLoop() and PostMessageLoop().
// S_FALSE => Skip RunMessageLoop(), call PostMessageLoop().
// error code => Failure. Skip both RunMessageLoop() and PostMessageLoop().
HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
{
    HRESULT hr = __super::PreMessageLoop(nShowCmd);
    if (FAILED(hr))
    {
        return hr;
    }
    // Note: In this sample, we don't respond differently to different hr success codes.

#if !defined(OS_WINDOWS_DESKTOP)
    // Allow only one instance of the application.
    // the "| 0x01" activates the correct owned window of the previous instance's main window
	HWND hWnd = NULL;
	for (int wait = 0; wait < m_nRestarting; wait++) {
		hWnd = FindWindow(CMainWindow::GetWndClassInfo().m_wc.lpszClassName, NULL);
		if (hWnd && m_nRestarting > 1) {
			Sleep(1000);
		} else {
			break;
		}
	}
	//EnumWindows(EnumRhodesWindowsProc, (LPARAM)&hWnd);

	if (hWnd)
	{
        SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
        SetForegroundWindow( hWnd );
		return S_FALSE;
	}

	// creating mutex
/*	m_hMutex = CreateMutex(NULL, TRUE, CMainWindow::GetWndClassInfo().m_wc.lpszClassName);
	if (m_hMutex==NULL) {
		// Failed to create mutex
		return S_FALSE;
	}
	if ((GetLastError() == ERROR_ALREADY_EXISTS) && (WaitForSingleObject(m_hMutex, 60000L) != WAIT_OBJECT_0)) {
        rho_sys_impl_exit_with_errormessage( "Initialization", "Another instance of the application is running. Please, exit it or use Task Manager to terminate it.");
        return S_FALSE;
	}*/
#endif

    if ( !rho_sys_check_rollback_bundle(rho_native_rhopath()) )
    {
        rho_sys_impl_exit_with_errormessage( "Bundle update", "Application is corrupted. Reinstall it, please.");
        return S_FALSE;
    }

#if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME)
    rho_logconf_Init((rho_wmimpl_get_logpath()[0]==0 ? m_strRootPath.c_str() : rho_wmimpl_get_logpath()), m_strRootPath.c_str(), m_logPort.c_str());
    if (rho_wmimpl_get_logurl()[0]!=0)
		LOGCONF().setLogURL(rho_wmimpl_get_logurl());
	if (rho_wmimpl_get_logmaxsize())
		LOGCONF().setMaxLogFileSize(*rho_wmimpl_get_logmaxsize());
    if (rho_wmimpl_get_loglevel())
		LOGCONF().setMinSeverity(*rho_wmimpl_get_loglevel());
    if (rho_wmimpl_get_fullscreen())
        RHOCONF().setBool("full_screen", true, false);
	if (rho_wmimpl_get_logmemperiod())
		LOGCONF().setCollectMemoryInfoInterval(*rho_wmimpl_get_logmemperiod());
#else
    rho_logconf_Init(m_strRootPath.c_str(), m_strRootPath.c_str(), m_logPort.c_str());
#endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME

//#if !defined(RHODES_EMULATOR) && !defined(OS_WINDOWS_DESKTOP)
	LOGCONF().setMemoryInfoCollector(CLogMemory::getInstance());
//#endif // RHODES_EMULATOR

#ifdef RHODES_EMULATOR
    RHOSIMCONF().setAppConfFilePath(CFilePath::join( m_strRootPath, RHO_EMULATOR_DIR"/rhosimconfig.txt").c_str());
    RHOSIMCONF().loadFromFile();
    if ( m_strRhodesPath.length() > 0 )
        RHOSIMCONF().setString("rhodes_path", m_strRhodesPath, false );
    RHOCONF().setString("rhosim_platform", RHOSIMCONF().getString("platform"), false);
    RHOCONF().setString("app_version", RHOSIMCONF().getString("app_version"), false);
	String start_path = RHOSIMCONF().getString("start_path");
    if ( start_path.length() > 0 )
	    RHOCONF().setString("start_path", start_path, false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/debugger;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/uri;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/timeout;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/digest;"), false);
    RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/openssl;"), false);
#endif

    if ( !rho_rhodesapp_canstartapp(g_strCmdLine.c_str(), " /-,") )
    {
#ifdef OS_WINDOWS_DESKTOP
	    ::MessageBoxW(0, L"This is hidden app and can be started only with security key.", L"Security Token Verification Failed", MB_ICONERROR | MB_OK);
#endif
		LOG(INFO) + "This is hidden app and can be started only with security key.";
		if (RHOCONF().getString("invalid_security_token_start_path").length() <= 0)
			return S_FALSE;
    }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: rho_sys_run_app

void rho_sys_run_app(const char *appname, VALUE params)
{
#ifdef RHODES_WIN32
    StringW strAppName;
    rho::common::convertToStringW(appname, strAppName);

	StringW strKeyPath = L"Software\\Rhomobile\\RhoGallery\\";
    strKeyPath += strAppName;
#else
    CFilePath oPath(appname);
    String strAppName = oPath.getFolderName();

    StringW strKeyPath = L"Software\\Apps\\";
    strKeyPath += convertToStringW(strAppName);
#endif

    StringW strParamsW;
    if ( params && !rho_ruby_is_NIL(params) )
    {
        convertToStringW(getStringFromValue(params), strParamsW);
    }

    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[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;

#ifdef RHODES_WIN32
			nChars = MAX_PATH;
	        res = oKey.QueryStringValue(L"Executable", szBuf, &nChars);
			if (res != ERROR_SUCCESS) {
			    LOG(ERROR) + "Cannot read registry key: Executable; Code:" + res;
				return;
			}
            StringW strExecutable = szBuf;

			rho_win32sys_run_appW(strExecutable.c_str(), strParamsW.c_str(), strFullPath.c_str());
#else
            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());
#endif
        }
    }
}
开发者ID:,项目名称:,代码行数:62,代码来源:

示例13: ReadArchiver

HRESULT WINAPI CZipFsEnum::ReadArchiver(__in_opt IVirtualFs * container, __in IFsEnumContext * context, __in void * stream)
{
	char filename_inzip[256] = {};
	unz_file_info64 file_info;
	unz_global_info64 gi;
	int err;
	bool	stopSearch = false;
	ULARGE_INTEGER maxFileSize;
	if (container == NULL || stream == NULL) return E_INVALIDARG;
	HRESULT hr = context->GetMaxFileSize(&maxFileSize);
	if (FAILED(hr)) return hr;

	unzFile uf = (unzFile)stream;

	err = unzGetGlobalInfo64(uf, &gi);
	if (err != UNZ_OK) return E_UNEXPECTED;

	for (ZPOS64_T i = 0; (i < gi.number_entry) && (!stopSearch); i++)
	{
		err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
		if (err != UNZ_OK) break;

		if (file_info.uncompressed_size > (ZPOS64_T)maxFileSize.QuadPart) // skip big-file
			continue;
		
		StringA strName = filename_inzip;
		StringW wstrName = AnsiToUnicode(&strName);

		IVirtualFs * zipFile = static_cast<IVirtualFs*>(new CZipFs());
		if (zipFile)
		{
			if (SUCCEEDED(zipFile->SetContainer(container)) &&
				SUCCEEDED(zipFile->Create(wstrName.c_str(), 0)) &&
				SUCCEEDED(zipFile->ReCreate((void*)uf)))
			{
				IFsAttribute * fsAttrib = NULL;
				if (SUCCEEDED(zipFile->QueryInterface(__uuidof(IFsAttribute), (LPVOID*)&fsAttrib)))
				{
					DWORD dwAttrib;

					if (SUCCEEDED(fsAttrib->Attributes(&dwAttrib)) &&
						(TEST_FLAG(dwAttrib, FILE_ATTRIBUTE_DIRECTORY) == 0))
					{
						int currentDepthInArchive = context->GetDepthInArchive();
						context->SetDepthInArchive(currentDepthInArchive + 1);
						hr = OnFileFound(zipFile, context, context->GetDepth() + 1);
						if (hr == E_ABORT)
						{
							stopSearch = true;
						}
						context->SetDepthInArchive(currentDepthInArchive);
					}

					fsAttrib->Release();
				}
			}

			ULONG flags;
			if (SUCCEEDED(zipFile->GetFlags(&flags)) &&
				TEST_FLAG(flags, IVirtualFs::fsDeferredDeletion))
			{
				container->DeferredDelete();
				stopSearch = true;
			}

			zipFile->Close();
			zipFile->Release();
		}

		err = unzGoToNextFile(uf);
		if (err != UNZ_OK) break;
	}

	return S_OK;
}
开发者ID:MeteorAdminz,项目名称:TinyAntivirus,代码行数:75,代码来源:ZipFsEnum.cpp

示例14: selectPicture

HRESULT Camera::selectPicture(HWND hwndOwner,LPTSTR pszFilename) 
{
	RHO_ASSERT(pszFilename);
#if defined( _WIN32_WCE ) //&& !defined( OS_PLATFORM_MOTCE )
	OPENFILENAMEEX ofnex = {0};
	OPENFILENAME ofn = {0};
#else
    OPENFILENAME ofn = {0};
#endif
    pszFilename[0] = 0;

	ofn.lStructSize     = sizeof(ofn);
    ofn.hwndOwner       = hwndOwner;
	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 )
	BOOL bRes = false;
	if(RHO_IS_WMDEVICE)
	{
		ofnex.ExFlags = OFN_EXFLAG_THUMBNAILVIEW|OFN_EXFLAG_NOFILECREATE|OFN_EXFLAG_LOCKDIRECTORY;
		bRes = lpfn_GetOpen_FileEx(&ofnex);
	}
	else
		bRes = GetOpenFileName(&ofn);

    if (bRes)
#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, '.');
		StringW strFileName = generate_filename(szExt);
		StringW strFullName = strBlobRoot + L"\\" + strFileName;

		if (copy_file( pszFilename, strFullName.c_str() )) 
        {
			wcscpy( pszFilename, strFileName.c_str() );
		} else {
			hResult = E_INVALIDARG;
		}

		return hResult;
	} else if (GetLastError()==ERROR_SUCCESS) {
		return S_FALSE; //user cancel op
	}
	return E_INVALIDARG;
}
开发者ID:arissetyawan,项目名称:rhodes,代码行数:63,代码来源:Camera.cpp

示例15: defined

extern "C" void rho_wm_impl_CheckLicense()
{   
#if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME)
    int nRes = 0;
    LOG(INFO) + "Start license_rc.dll";
    HINSTANCE hLicenseInstance = LoadLibrary(L"license_rc.dll");
    LOG(INFO) + "Stop license_rc.dll";
    

    if(hLicenseInstance)
    {
        PCL pCheckLicense = (PCL) GetProcAddress(hLicenseInstance, L"CheckLicense");
        FUNC_IsLicenseOK pIsOK = (FUNC_IsLicenseOK) GetProcAddress(hLicenseInstance, L"IsLicenseOK");
        LPCWSTR szLogText = 0;
        if(pCheckLicense)
        {
            StringW strLicenseW;
            StringW strCompanyW;

        #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME)
            LPCTSTR szLicense = rho_wmimpl_sharedconfig_getvalue( L"LicenseKey" );
            if ( szLicense )
                strLicenseW = szLicense;

            LPCTSTR szLicenseComp = rho_wmimpl_sharedconfig_getvalue( L"LicenseKeyCompany" );
            if ( szLicenseComp )
                strCompanyW = szLicenseComp;
        #endif

            StringW strAppNameW;
            strAppNameW = RHODESAPP().getAppNameW();
            szLogText = pCheckLicense( getMainWnd(), strAppNameW.c_str(), strLicenseW.c_str(), strCompanyW.c_str() );
        }

        if ( szLogText && *szLogText )
            LOGC(INFO, "License") + szLogText;

        nRes = pIsOK ? pIsOK() : 0;
    }

#ifdef APP_BUILD_CAPABILITY_SYMBOL
    if ( nRes == 0 )
    {
        rho::BrowserFactory::getInstance()->checkLicense(getMainWnd(), hLicenseInstance);
        return;
    }
#endif

#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
    if ( nRes )
    {
        FUNC_GetAppLicenseObj pGetAppLicenseObj = (FUNC_GetAppLicenseObj) GetProcAddress(hLicenseInstance, L"GetAppLicenseObj");
        if ( pGetAppLicenseObj )
            rho_wm_impl_SetApplicationLicenseObj( pGetAppLicenseObj() );
    }
#endif

    if ( !nRes )
        ::PostMessage( getMainWnd(), WM_SHOW_LICENSE_WARNING, 0, 0);
#endif
}
开发者ID:rhosilver,项目名称:rhodes-1,代码行数:61,代码来源:Rhodes.cpp


注:本文中的StringW::c_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。