本文整理汇总了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();