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


C++ CefString::ToWString方法代码示例

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


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

示例1: GetIcon

HICON TransparentWnd::GetIcon(CefString path){
	if(path.ToWString().find(L":")==-1){
		wstring _path;
		_path=url.ToWString();
		replace_allW(_path, L"\\", L"/");
		_path=_path.substr(0,_path.find_last_of('/')+1);
		path=_path.append(path);
	}
	return (HICON)::LoadImage(NULL,path.ToWString().data(),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); 
	//Bitmap bm(path.ToWString().data());
	//HICON hIcon;
	//bm.GetHICON(&hIcon);
	//return hIcon;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:14,代码来源:transparent_wnd.cpp

示例2: RunApp

void TransparentWnd::RunApp(CefString appName, CefString param, CefString baseUrl){
	wstring appNameW=appName.ToWString();
	wstring path;
	if(!baseUrl.length()){
		path=modulePath;
	}
	else{
		path=baseUrl.ToWString();
		replace_allW(path, L"\\", L"/");
		path=path.substr(0,path.find_last_of('/')+1);
	}
	if(appNameW.find(L":")==-1){
		appNameW=path.append(appNameW);
	}
	CreateBrowser(appNameW,param);
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:16,代码来源:transparent_wnd.cpp

示例3: GetSaveName

CefString TransparentWnd::GetSaveName(CefString fileName){
	TCHAR szFile[2048];
	SaveFileDialog(hWnd, fileName.ToWString().data(), szFile);
	wstring d(szFile);
	CefString s(d);
	return s;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:7,代码来源:transparent_wnd.cpp

示例4: GetOpenName

CefString TransparentWnd::GetOpenName(CefString fileName){
	TCHAR szFile[4096];
	OpenFileDialog(hWnd, fileName.ToWString().data(), szFile);
	wstring d(szFile);
	CefString s(d);
	return s;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:7,代码来源:transparent_wnd.cpp

示例5:

FWebBrowserPopupFeatures::FWebBrowserPopupFeatures( const CefPopupFeatures& PopupFeatures )
{
	X = PopupFeatures.x;
	bXSet = PopupFeatures.xSet ? true : false;
	Y = PopupFeatures.y;
	bYSet = PopupFeatures.ySet ? true : false;
	Width = PopupFeatures.width;
	bWidthSet = PopupFeatures.widthSet ? true : false;
	Height = PopupFeatures.height;
	bHeightSet = PopupFeatures.heightSet ? true : false;
	bMenuBarVisible = PopupFeatures.menuBarVisible ? true : false;
	bStatusBarVisible = PopupFeatures.statusBarVisible ? true : false;
	bToolBarVisible = PopupFeatures.toolBarVisible ? true : false;
	bLocationBarVisible = PopupFeatures.locationBarVisible ? true : false;
	bScrollbarsVisible = PopupFeatures.scrollbarsVisible ? true : false;
	bResizable = PopupFeatures.resizable ? true : false;
	bIsFullscreen = PopupFeatures.fullscreen ? true : false;
	bIsDialog = PopupFeatures.dialog ? true : false;

	int Count = PopupFeatures.additionalFeatures ? cef_string_list_size(PopupFeatures.additionalFeatures) : 0;
	CefString ListValue;

	for(int ListIdx = 0; ListIdx < Count; ListIdx++) 
	{
		cef_string_list_value(PopupFeatures.additionalFeatures, ListIdx, ListValue.GetWritableStruct());
		AdditionalFeatures.Add(ListValue.ToWString().c_str());
	}

}
开发者ID:colwalder,项目名称:unrealengine,代码行数:29,代码来源:WebBrowserPopupFeatures.cpp

示例6: url

QUrl QCefWebView::url() const {
    if (GetBrowser().get()) {
        CefString url = GetBrowser()->GetMainFrame()->GetURL();
        return QUrl(QString::fromStdWString(url.ToWString()));
    }
    return QUrl();
}
开发者ID:Ali-I,项目名称:CsoundQt,代码行数:7,代码来源:qcefwebview.cpp

示例7: UploadCrashLogs

bool CaffeineClientApp::UploadCrashLogs(CefString AppVersion, CefString UserDescription)
{
    bool retval = false;
    HANDLE hFind = INVALID_HANDLE_VALUE;
    WIN32_FIND_DATA ffd;

    //  Get the crash logs folder and append '\*.zip' to it.
    wstring CrashDir = GetCrashLogsDirectory();
    wstring ZippedLogs = CrashDir + L"\\*.zip";

    // Find the first file in the directory.
    hFind = FindFirstFile(ZippedLogs.c_str(), &ffd);
    if (INVALID_HANDLE_VALUE != hFind) 
    {
        do
        {
            TCHAR szFullPath[MAX_PATH*2] = {0,};

            StringCchCopy(szFullPath, MAX_PATH*2, CrashDir.c_str());
            PathAppend(szFullPath, ffd.cFileName);

            InterlockedIncrement(&log_count);

            InsertDescriptionIntoCrashLogs(szFullPath, UserDescription.ToWString());
            PostCrashLogs(szFullPath, AppVersion, UserDescription);
        } while (FindNextFile(hFind, &ffd) != 0);
        FindClose(hFind);

        retval = true;
    }

    return retval;
}
开发者ID:sfrancisx,项目名称:Caffeine,代码行数:33,代码来源:CaffeineClientAppWin.cpp

示例8: ToImageEx

void TransparentWnd::ToImageEx(CefString path, int _x, int _y, int _width, int _height){
	if(!hBitMap){
		return;
	}
	Bitmap bm(_width,_height);
	Rect r(0,0,_width,_height);
	BitmapData bmData;
	bm.LockBits(&r, ImageLockModeWrite, PixelFormat32bppPARGB, &bmData);
	int l=width*height*4;
	PBYTE p1=new BYTE[l];
	GetBitmapBits(hBitMap, l, p1);
	byte* p = (byte*)bmData.Scan0;
	int count=0;
	for(int j=0;j<_height;++j){
		for (int i = 0; i < _width; i++)
		{
			for(int k=0; k<4;++k){
				int pos = (_y+j)*width*4+(_x+i)*4;
				p[count]=p1[pos+k];
				++count;
			}
		}
	}
	delete []p1;
	bm.UnlockBits(&bmData);
	CLSID tiffClsid;
	GetEncoderClsid((L"image/"+GetExtW(path.ToWString())).data(), &tiffClsid);
	bm.Save(TranslatePath(path).ToWString().data(), &tiffClsid);
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:29,代码来源:transparent_wnd.cpp

示例9: InjectWebinos

// Inject webinos.js
// The file is loaded from the webinos\test\client folder if possible.
// If this fails, the current folder is used.
void ClientApp::InjectWebinos(CefRefPtr<CefFrame> frame)
{
  CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();

  // First try and load the platform-supplied webinos.js
  std::string pzpPath = AppGetWebinosWRTConfig(NULL,NULL);
  CefString wrtPath;

  // Make sure there is a trailing separator on the path.
  if (pzpPath.length() > 0) 
  {
    if (pzpPath.find_last_of('/') == pzpPath.length()-1 || pzpPath.find_last_of('\\') == pzpPath.length()-1)
      wrtPath = pzpPath + "wrt/webinos.js";
    else
      wrtPath = pzpPath + "/wrt/webinos.js";
  }

#if defined(OS_WIN)
  base::FilePath webinosJSPath(wrtPath.ToWString().c_str());
#else
  base::FilePath webinosJSPath(wrtPath);
#endif

  LOG(INFO) << "webinos.js path is " << wrtPath;

  int64 webinosJSCodeSize;
  bool gotJSFile = base::GetFileSize(webinosJSPath, &webinosJSCodeSize);
  if (gotJSFile)
  {
    char* webinosJSCode = new char[webinosJSCodeSize+1];
    base::ReadFile(webinosJSPath, webinosJSCode, webinosJSCodeSize);
    webinosJSCode[webinosJSCodeSize] = 0;

    if (frame == NULL)
    {
      // Register as a Cef extension.
      CefRegisterExtension("webinos", webinosJSCode, NULL);
    }
    else
    {
      // Run the code in the frame javascript context right now,
      // but only if the URL refers to the widget server.
      int widgetServerPort;
      AppGetWebinosWRTConfig(NULL,&widgetServerPort);

      char injectionCandidate[MAX_URL_LENGTH];
      sprintf(injectionCandidate,"http://localhost:%d",widgetServerPort);

      std::string url = frame->GetURL();
      if (url.substr(0,strlen(injectionCandidate)) == injectionCandidate)
        frame->ExecuteJavaScript(webinosJSCode, url, 0);
    }

    delete[] webinosJSCode;
  }
  else
  {
    	LOG(ERROR) << "Can't find webinos.js";
  }
}
开发者ID:ubiapps,项目名称:ubiapps-browser,代码行数:63,代码来源:client_app.cpp

示例10: SetToolTip

void FCEFWebBrowserWindow::SetToolTip(const CefString& CefToolTip)
{
	FString NewToolTipText = CefToolTip.ToWString().c_str();
	if (ToolTipText != NewToolTipText)
	{
		ToolTipText = NewToolTipText;
		OnToolTip().Broadcast(ToolTipText);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:9,代码来源:CEFWebBrowserWindow.cpp

示例11: OnTitleChange

void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
  REQUIRE_UI_THREAD();
  if (!listener_) return;

  if (m_BrowserId == browser->GetIdentifier()) {
    listener_->OnTitleChange(QString::fromStdWString(title.ToWString()));
  }
}
开发者ID:AmesianX,项目名称:qtcefclient,代码行数:9,代码来源:client_handler_qt.cpp

示例12: TranslatePath

CefString TransparentWnd::TranslatePath(CefString path){
	wstring pathS=path.ToWString();
	wstring urlS=url.ToWString();
	replace_allW(urlS,L"file:///",L"");
	if(pathS.find(L":")==-1){
		int index1=urlS.find_last_of(L"/");
		pathS=urlS.substr(0,index1+1).append(pathS);
	}
	return pathS;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:10,代码来源:transparent_wnd.cpp

示例13: OnAddressChange

void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
                                    CefRefPtr<CefFrame> frame,
                                    const CefString& url) {
  REQUIRE_UI_THREAD();
  if (!listener_) return;

  if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
    listener_->OnAddressChange(QString::fromStdWString(url.ToWString()));
  }
}
开发者ID:AmesianX,项目名称:qtcefclient,代码行数:10,代码来源:client_handler_qt.cpp

示例14: OnBeforePopup

bool WebRendererHandler::OnBeforePopup(CefRefPtr<CefBrowser> p_Browser, CefRefPtr<CefFrame> p_Frame, const CefString& p_Url, const CefString& p_FrameName, CefLifeSpanHandler::WindowOpenDisposition p_Disposition, bool p_UserGesture, const CefPopupFeatures& p_Features, CefWindowInfo& p_WindowInfo, CefRefPtr<CefClient>& p_Client, CefBrowserSettings& p_Settings, bool* p_NoJavaScript)
{
	// Make sure that the URL starts with http:// or https:// so it can't be used to execute arbitrary shell commands
	auto s_UrlStr = p_Url.ToWString();
	if (!boost::istarts_with(s_UrlStr, L"http://") && !boost::istarts_with(s_UrlStr, L"https://"))
		s_UrlStr = L"http://" + s_UrlStr;

	// Open the URL in the user's browser
	ShellExecuteW(nullptr, L"open", s_UrlStr.c_str(), L"", nullptr, SW_SHOWNORMAL);
	return true;
}
开发者ID:Shad0wShayd3,项目名称:ElDorito,代码行数:11,代码来源:WebRendererHandler.cpp

示例15: GetIcon

HICON GetIcon(CefString url, CefString path){
	if (path.ToWString().find(L":") == -1){// 如果指定的路径是相对路径
		wstring _path;
		_path = url.ToWString();
		jw::replace_allW(_path, L"\\", L"/");
		_path = _path.substr(0, _path.find_last_of('/') + 1);
		path = _path.append(path);
	}
	Gdiplus::GdiplusStartupInput StartupInput;
	ULONG_PTR m_gdiplusToken;
	Gdiplus::Status sResult = Gdiplus::GdiplusStartup(&m_gdiplusToken, &StartupInput, NULL);
	if (sResult == Gdiplus::Ok){
		Gdiplus::Bitmap * bb = Gdiplus::Bitmap::FromFile(path.c_str(), false);
		HICON hIcon = NULL;
		bb->GetHICON(&hIcon);
		delete bb;
		Gdiplus::GdiplusShutdown(m_gdiplusToken);// 关闭gdi
		return hIcon;
	}
	return NULL;
}
开发者ID:penbor,项目名称:jwebtop,代码行数:21,代码来源:JWebTopWndProc.cpp


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