本文整理汇总了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;
}
示例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);
}
示例3: GetSaveName
CefString TransparentWnd::GetSaveName(CefString fileName){
TCHAR szFile[2048];
SaveFileDialog(hWnd, fileName.ToWString().data(), szFile);
wstring d(szFile);
CefString s(d);
return s;
}
示例4: GetOpenName
CefString TransparentWnd::GetOpenName(CefString fileName){
TCHAR szFile[4096];
OpenFileDialog(hWnd, fileName.ToWString().data(), szFile);
wstring d(szFile);
CefString s(d);
return s;
}
示例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());
}
}
示例6: url
QUrl QCefWebView::url() const {
if (GetBrowser().get()) {
CefString url = GetBrowser()->GetMainFrame()->GetURL();
return QUrl(QString::fromStdWString(url.ToWString()));
}
return QUrl();
}
示例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;
}
示例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);
}
示例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";
}
}
示例10: SetToolTip
void FCEFWebBrowserWindow::SetToolTip(const CefString& CefToolTip)
{
FString NewToolTipText = CefToolTip.ToWString().c_str();
if (ToolTipText != NewToolTipText)
{
ToolTipText = NewToolTipText;
OnToolTip().Broadcast(ToolTipText);
}
}
示例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()));
}
}
示例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;
}
示例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()));
}
}
示例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;
}
示例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;
}