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


C++ AppConfig::GetAppID方法代码示例

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


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

示例1: if


//.........这里部分代码省略.........
	// set the custom user agent for Titanium
	double version = host->GetGlobalObject()->Get("version")->ToDouble();
	char userAgent[128];
	sprintf(userAgent, "%s/%0.2f", PRODUCT_NAME, version);
	_bstr_t ua(userAgent);
	web_view->setApplicationNameForUserAgent(ua.copy());

	// place our user agent string in the global so we can later use it
	SharedBoundObject global = host->GetGlobalObject();
	_bstr_t uaurl("http://titaniumapp.com");
	BSTR uaresp;
	web_view->userAgentForURL(uaurl.copy(), &uaresp);
	std::string ua_str = _bstr_t(uaresp);
	global->Set("userAgent", Value::NewString(ua_str.c_str()));

	std::cout << "create frame load delegate " << std::endl;
	frameLoadDelegate = new Win32WebKitFrameLoadDelegate(this);
	uiDelegate = new Win32WebKitUIDelegate(this);
	policyDelegate = new Win32WebKitPolicyDelegate(this);

	std::cout << "set delegates, set host window, webview=" << (int) web_view
			<< std::endl;
	hr = web_view->setFrameLoadDelegate(frameLoadDelegate);
	hr = web_view->setUIDelegate(uiDelegate);
	hr = web_view->setPolicyDelegate(policyDelegate);
	hr = web_view->setHostWindow((OLE_HANDLE) window_handle);

	std::cout << "init with frame" << std::endl;
	RECT client_rect;
	GetClientRect(window_handle, &client_rect);
	hr = web_view->initWithFrame(client_rect, 0, 0);

	AppConfig *appConfig = AppConfig::Instance();
	std::string appid = appConfig->GetAppID();

	IWebPreferences *prefs = NULL;
	hr = CoCreateInstance(CLSID_WebPreferences, 0, CLSCTX_ALL,
			IID_IWebPreferences, (void**) &prefs);
	if (FAILED(hr) || prefs == NULL) {
		std::cerr << "Couldn't create the preferences object" << std::endl;
	} else {
		_bstr_t pi(appid.c_str());
		prefs->initWithIdentifier(pi.copy(), &prefs);

		prefs->setCacheModel(WebCacheModelDocumentBrowser);
		prefs->setPlugInsEnabled(true);
		prefs->setJavaEnabled(true);
		prefs->setJavaScriptEnabled(true);
		prefs->setDOMPasteAllowed(true);

		IWebPreferencesPrivate* privatePrefs = NULL;
		hr = prefs->QueryInterface(IID_IWebPreferencesPrivate,
				(void**) &privatePrefs);
		if (FAILED(hr)) {
			std::cerr << "Failed to get private preferences" << std::endl;
		} else {
			privatePrefs->setDeveloperExtrasEnabled(host->IsDebugMode());
			//privatePrefs->setDeveloperExtrasEnabled(host->IsDebugMode());
			privatePrefs->setDatabasesEnabled(true);
			privatePrefs->setLocalStorageEnabled(true);
			privatePrefs->setOfflineWebApplicationCacheEnabled(true);

			_bstr_t db_path(
					FileUtils::GetApplicationDataDirectory(appid).c_str());
			privatePrefs->setLocalStorageDatabasePath(db_path.copy());
			privatePrefs->Release();
开发者ID:rlwesq,项目名称:titanium,代码行数:67,代码来源:win32_user_window.cpp


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