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


C++ CefWindowInfo::SetAsChild方法代码示例

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


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

示例1: CreateBrowser

bool QCefWebView::CreateBrowser(const QSize& size) {
    //qDebug() << __FUNCTION__ << __LINE__;
    if (browser_state_ != kNone || size.isEmpty()) {
        return false;
    }
    mutex_.lock();
    if (browser_state_ != kNone) {
        mutex_.unlock();
        return false;
    }
    //qDebug() << __FUNCTION__ << __LINE__;
    CefWindowInfo info;
    CefBrowserSettings settings;
#if defined(WIN32)
    RECT rect = {0, 0, size.width(), size.height()};
    info.SetAsChild((HWND) this->winId(), rect);
#else
    CefRect rect(0, 0, size.width(), size.height());
    info.SetAsChild(this->winId(), rect);
#endif
    qcef_client_handler->set_listener(this);
    QString url = url_.isEmpty() ? kUrlBlank : url_.toString();
    CefBrowserHost::CreateBrowser(info,
                                  qcef_client_handler.get(),
                                  CefString(url.toStdWString()),
                                  settings,
                                  NULL);

    browser_state_ = kCreating;
    mutex_.unlock();
    return true;
}
开发者ID:CsoundQt,项目名称:CsoundQt,代码行数:32,代码来源:qcefwebview.cpp

示例2: HandleCreate

// WM_CREATE handler
BOOL cef_main_window::HandleCreate() 
{
    // Create the single static handler class instance
    g_handler = new ClientHandler();
    g_handler->SetMainHwnd(mWnd);

    RECT rect;

    GetCefBrowserRect(rect);

    CefWindowInfo info;
    CefBrowserSettings settings;

    settings.web_security = STATE_DISABLED;

    // Initialize window info to the defaults for a child window
    info.SetAsChild(mWnd, rect);

    // Creat the new child browser window
    CefBrowserHost::CreateBrowser(info,
        static_cast<CefRefPtr<CefClient> >(g_handler),
        ::AppGetInitialURL(), settings);

    return TRUE;
}
开发者ID:Limecraft,项目名称:brackets-shell,代码行数:26,代码来源:cef_main_window.cpp

示例3: AddWebView

void AddWebView(CefWindowHandle parent, RECT windowRect, char* url, Settings* settings) {
  CefWindowInfo windowInfo;
  windowInfo.SetAsChild(parent, windowRect);
  windowInfo.SetTransparentPainting(true);
  g_handler->browserSettings_.web_security_disabled = settings->getBoolean("disableSecurity", false);
  CefBrowser::CreateBrowser(windowInfo, static_cast<CefRefPtr<CefClient>>(g_handler), url, g_handler->browserSettings_);
}
开发者ID:Houfeng,项目名称:appjs,代码行数:7,代码来源:native_window_win.cpp

示例4: OnCreate

int CefJamCEFHtmlView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CView::OnCreate(lpCreateStruct) == -1)
        return -1;

    // TODO:  Add your specialized creation code here


    CRect rcClient;
    this->GetClientRect(&rcClient);

    // TODO:  Add your specialized creation code here
    CefRefPtr<CefJamClientHandler> client(new CefJamClientHandler());
    m_pClientHandler = client;

    CefWindowInfo info;
    info.SetAsChild( m_hWnd, rcClient);

    CefBrowserSettings browserSettings;

    //static_cast<CefRefPtr<CefClient> >(client)
    bool bCreate = CefBrowserHost::CreateBrowser( info,static_cast<CefRefPtr<CefClient> >(client),
                   "http://www.baidu.com", browserSettings);

    return 0;
}
开发者ID:ZackLin,项目名称:CEF3Jam,代码行数:26,代码来源:CefJamCEFHtmlView.cpp

示例5: OnCreate

int CTransChatWebWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!theApp.GetWindowManager()->Attach(GetSafeHwnd(), _T("trans_chat_web_wnd")))
		return -1;
	
	SetWindowText(_T("专人翻译"));

	g_SessionData.chat_hwnd = GetSafeHwnd();

	m_shadow_win.create(GetSafeHwnd());

	m_Recorder.Attach(GetSafeHwnd());

	//m_pV8Exthandler = new ClientV8ExtHandler(this);

	CefRefPtr<CefWebClient> client(new CefWebClient());
	m_cWebClient = client;

	CefSettings cSettings;
	CefSettingsTraits::init(&cSettings);
	cSettings.multi_threaded_message_loop = true;
	CefRefPtr<CefApp> spApp;
	CefInitialize(cSettings, spApp);

	//CefRegisterExtension("v8/Ext", s_JsExt, m_pV8Exthandler);

	duHwndObj* pWebHwndobj = (duHwndObj*)GetPluginByName(GetSafeHwnd(), _T("chat_web_hwndobj"));
	RECT rc = { 0, 0, 0, 0 };
	pWebHwndobj->GetRect(&rc);
	CefWindowInfo info;
	info.SetAsChild(GetSafeHwnd(), rc);

	TCHAR szHtml[MAX_PATH] = { 0 };
	::GetModuleFileName(GetModuleHandle(NULL), szHtml, _countof(szHtml));
	::PathRemoveFileSpec(szHtml);
	::PathAppend(szHtml, _T("html\\trans.html"));

	CefBrowserSettings browserSettings;
	CefBrowser::CreateBrowser(info, static_cast<CefRefPtr<CefClient>>(client),
		szHtml, browserSettings);

	InitExtension();
	//RunExtensionTest(m_cWebClient->GetBrowser());

	//pWebHwndobj->Attach(m_cWebClient->GetBrowser()->GetWindowHandle());

	//m_Recorder.StartRecord();
	
	//StrCpy(m_szVoicePath, _T("C:\\Users\\Administrator\\AppData\\Roaming\\MyEcho\\oDHO7Q3LRUtxLg4E9R1adjrsv5irzYa8\\task\\test.amr"));

	return 0;
}
开发者ID:tantaishan,项目名称:MyEcho,代码行数:55,代码来源:TransChatWebWnd.cpp

示例6: CreateBrowser

void CefFacade::CreateBrowser(HWND Parent_,const char* startUrl_,pFun pFn_)
{	
	m_clientHandler = new ClientHandler(pFn_); 

	CefWindowInfo info;  
	CefBrowserSettings b_settings;  

	RECT rect;
	GetClientRect(Parent_,&rect);
	info.SetAsChild(Parent_, rect);  

	if(strlen(startUrl_)==0)
		m_StartupURL="about://blank";
	else
		m_StartupURL = string_To_UTF8(startUrl_);
	CefBrowserHost::CreateBrowser(info, m_clientHandler.get(), m_StartupURL, b_settings, NULL);
}
开发者ID:116356754,项目名称:libcef,代码行数:17,代码来源:CefFacade.cpp

示例7: CreateBrowser

	void __stdcall CreateBrowser(HWND Parent_,const char* startUrl_=NULL)
	{
		s_clientHandler = new ClientHandler(NULL); 

		CefWindowInfo info;  
		CefBrowserSettings b_settings;  

		RECT rect;
		GetClientRect(Parent_,&rect);
		info.SetAsChild(Parent_, rect);  
		
		std::string m_StartupURL;
		if(strlen(startUrl_)==0)
			m_StartupURL="about://blank";
		else
			m_StartupURL = string_To_UTF8(startUrl_);
		CefBrowserHost::CreateBrowser(info, s_clientHandler.get(), m_StartupURL, b_settings, NULL);
	}
开发者ID:116356754,项目名称:libcef,代码行数:18,代码来源:main.cpp

示例8: SimpleCEFDLL_CreateBrowser

//Create the browser in our previously created window with hWnd handle
//and the url to load. This function must be called in WM_CREATE
void SimpleCEFDLL_CreateBrowser( HWND hWnd, const wchar_t* url )
{
	CefRefPtr<zSimpleCefHandler> simpleCefHandler = new zSimpleCefHandler;

	g_App->SetCEFHandler( hWnd, simpleCefHandler );

	//We fill the info to adapt our window to embedd the browser
	CefWindowInfo info;

	//Get the window rect
	RECT rect;
	GetClientRect( hWnd, &rect);
	
	//We will create the browser as a child of our window
	info.SetAsChild( hWnd,rect);

	CefBrowserSettings settingsBrowser;
    CefBrowserHost::CreateBrowser(info, simpleCefHandler.get(), CefString( url ), settingsBrowser, NULL);
}
开发者ID:xiongxiaoping,项目名称:SimpleCEFDLL,代码行数:21,代码来源:SimpleCEFDLL.cpp

示例9: cef_init

value cef_init()
{
	CefSettings settings;
	CefMainArgs args;
	settings.multi_threaded_message_loop = true;
	printf("before init\n");
	CefInitialize(args, settings, NULL);
	printf("after init\n");
	
	HWND hWnd;
	RECT rect;

	// Init First Chrome
	CefBrowserSettings browserSettings;
	CefWindowInfo info;

	g_handler = new myClientHandler();
	DWORD dwProcID = GetCurrentProcessId();
	hWnd = GetTopWindow(GetDesktopWindow());
	while(hWnd)
    {
		DWORD dwWndProcID = 0;
		GetWindowThreadProcessId(hWnd, &dwWndProcID);
		if(dwWndProcID == dwProcID)
			break; 
		hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);
    }
	
	printf("hwnd %d\n", hWnd);

	GetClientRect(hWnd, &rect);
	printf("before client rect\n");
	info.SetAsChild(hWnd,rect);
	printf("set as child\n");

	CefBrowserHost::CreateBrowser(info,static_cast< CefRefPtr<CefClient> >(g_handler),"http://www.google.com", browserSettings);
	printf("create browser\n");
	
	return alloc_null();
}
开发者ID:waneck,项目名称:cef-nme,代码行数:40,代码来源:hxcef.cpp

示例10: OnInitialUpdate

void CCEFView::OnInitialUpdate()
{
	CView::OnInitialUpdate();

    CefRefPtr<ClientHandler> client(new ClientHandler());
	m_clientHandler = client;

    CefWindowInfo info;
	RECT rect;
	GetClientRect(&rect);
	info.SetAsChild(GetSafeHwnd(), rect);

	CefBrowserSettings browserSettings;
  browserSettings.web_security_disabled = true;

	char path_buffer[_MAX_PATH];
	char drive[_MAX_DRIVE];
	char dir[_MAX_DIR];
	char fname[_MAX_FNAME];
	char ext[_MAX_EXT];
	errno_t err;
	GetModuleFileNameA(NULL, path_buffer, sizeof(path_buffer));
	err = _splitpath_s(path_buffer, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT);
	if (err != 0)
	{
		//TODO: Add Error Handler
	}
	std::string s = dir;
	s += "html";
	err = _makepath_s(path_buffer, _MAX_PATH, drive, s.c_str(), "index", "html");
	if (err != 0)
	{
		//TODO: Add Error Handler
	}
	CefBrowser::CreateBrowser(info, static_cast<CefRefPtr<CefClient> >(client), path_buffer, browserSettings); 

	// TODO: Add your specialized code here and/or call the base class
}
开发者ID:Omgan,项目名称:cef-mfc,代码行数:38,代码来源:CEFView.cpp

示例11: CreateBrowser

bool QCefWebView::CreateBrowser(const QSize& size) {
  //qDebug() << __FUNCTION__ << __LINE__;
  if (browser_state_ != kNone || size.isEmpty()) {
    return false;
  }
  mutex_.lock();
  if (browser_state_ != kNone) {
    mutex_.unlock();
    return false;
  }
  //qDebug() << __FUNCTION__ << __LINE__;
  RECT rect;
  rect.left = 0;
  rect.top = 0;
  rect.right = size.width();
  rect.bottom = size.height();

  CefWindowInfo info;
  CefBrowserSettings settings;

  // By default, as a child window.
  info.SetAsChild(this->winId(), rect);

  g_handler->set_listener(this);

  QString url = url_.isEmpty() ? kUrlBlank : url_.toString();
  CefBrowserHost::CreateBrowser(info,
                                g_handler.get(),
                                CefString(url.toStdWString()),
                                settings,
                                NULL);

  browser_state_ = kCreating;
  mutex_.unlock();
  return true;
}
开发者ID:AmesianX,项目名称:qtcefclient,代码行数:36,代码来源:qcefwebview.cpp

示例12: WndProc


//.........这里部分代码省略.........
                              WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
                              | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
                              hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
      x += BUTTON_WIDTH;

      editWnd = CreateWindow(L"EDIT", 0,
                              WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
                              ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
                              x, 0, rect.right - BUTTON_WIDTH * 4,
                              URLBAR_HEIGHT, hWnd, 0, hInst, 0);

      // Assign the edit window's WNDPROC to this function so that we can
      // capture the enter key
      editWndOldProc =
          reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
      SetWindowLongPtr(editWnd, GWLP_WNDPROC,
          reinterpret_cast<LONG_PTR>(WndProc));
      g_handler->SetEditHwnd(editWnd);
      g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);

      rect.top += URLBAR_HEIGHT;
#endif // SHOW_TOOLBAR_UI

      CefWindowInfo info;
      CefBrowserSettings settings;

      // Populate the settings based on command line arguments.
      AppGetBrowserSettings(settings);

      settings.file_access_from_file_urls_allowed = true;
      settings.universal_access_from_file_urls_allowed = true;

      // Initialize window info to the defaults for a child window
      info.SetAsChild(hWnd, rect);

      // Creat the new child browser window
      CefBrowserHost::CreateBrowser(info,
          static_cast<CefRefPtr<CefClient> >(g_handler),
          szInitialUrl, settings);

      return 0;
    }

    case WM_COMMAND: {
      CefRefPtr<CefBrowser> browser;
      if (g_handler.get())
        browser = g_handler->GetBrowser();

      wmId    = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId) {
      case IDM_EXIT:
        if (g_handler.get()) {
          g_handler->QuittingApp(true);
    	  g_handler->DispatchCloseToNextBrowser();
    	} else {
          DestroyWindow(hWnd);
		}
        return 0;
      case ID_WARN_CONSOLEMESSAGE:
/*
        if (g_handler.get()) {
          std::wstringstream ss;
          ss << L"Console messages will be written to "
              << std::wstring(CefString(g_handler->GetLogFile()));
开发者ID:matt-wratt,项目名称:brackets-shell,代码行数:67,代码来源:cefclient_win.cpp

示例13: WndProc


//.........这里部分代码省略.........
                                hInst, 0);
      x += BUTTON_WIDTH;

      stopWnd = CreateWindow(L"BUTTON", L"Stop",
                              WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
                              | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
                              hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
      x += BUTTON_WIDTH;

      editWnd = CreateWindow(L"EDIT", 0,
                              WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
                              ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
                              x, 0, rect.right - BUTTON_WIDTH * 4,
                              URLBAR_HEIGHT, hWnd, 0, hInst, 0);

      // Assign the edit window's WNDPROC to this function so that we can
      // capture the enter key
      editWndOldProc =
          reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
      SetWindowLongPtr(editWnd, GWLP_WNDPROC,
          reinterpret_cast<LONG_PTR>(WndProc));
      g_handler->SetEditHwnd(editWnd);
      g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);

      rect.top += URLBAR_HEIGHT;

      CefWindowInfo info;
      CefBrowserSettings settings;

      // Populate the settings based on command line arguments.
      AppGetBrowserSettings(settings);

      // Initialize window info to the defaults for a child window
      info.SetAsChild(hWnd, rect);

      // Creat the new child browser window
      CefBrowserHost::CreateBrowser(info, g_handler.get(),
          g_handler->GetStartupURL(), settings);

      return 0;
    }

    case WM_COMMAND: {
      CefRefPtr<CefBrowser> browser;
      if (g_handler.get())
        browser = g_handler->GetBrowser();

      wmId    = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId) {
      case IDM_ABOUT:
        DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
        return 0;
      case IDM_EXIT:
        DestroyWindow(hWnd);
        return 0;
      case ID_WARN_CONSOLEMESSAGE:
        if (g_handler.get()) {
          std::wstringstream ss;
          ss << L"Console messages will be written to "
              << std::wstring(CefString(g_handler->GetLogFile()));
          MessageBox(hWnd, ss.str().c_str(), L"Console Messages",
              MB_OK | MB_ICONINFORMATION);
        }
        return 0;
开发者ID:appjs,项目名称:cef3,代码行数:67,代码来源:cefclient_win.cpp

示例14: MainWindowWndProc

//
//  FUNCTION: MainWindowWndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
LRESULT CALLBACK MainWindowWndProc(
    HWND hWnd, 
    UINT message, 
    WPARAM wParam,
    LPARAM lParam) 
{
    PAINTSTRUCT ps;
    HDC hdc;
    HMENU sysMenu;

    // Callback for the main window
    switch (message) 
    {
        case WM_CREATE: 
        {
            DWORD bufferSize = 65535;
            wstring buff;
            buff.resize(bufferSize);
            bufferSize = ::GetEnvironmentVariable(L"lala", &buff[0], bufferSize);

            if (bufferSize)
            {
                buff.resize(bufferSize);
                SetEnvironmentVariable(L"lala", NULL);
            }

            // Add exit option to system menu
            TCHAR szDescription[INFOTIPSIZE];
            StringManager.LoadString(IDS_EXIT_CAFFEINE, szDescription, INFOTIPSIZE);

            sysMenu = GetSystemMenu(hWnd, FALSE);
            InsertMenu(sysMenu, 2, MF_SEPARATOR, 0, L"-");
            AppendMenu(sysMenu, MF_STRING, IDS_EXIT_CAFFEINE, szDescription);

            WTSRegisterSessionNotification(hWnd, NOTIFY_FOR_THIS_SESSION);
            app->m_WindowHandler[mainUUID] = new CaffeineClientHandler();
            app->m_WindowHandler[mainUUID]->SetMainHwnd(hWnd);

            // Create the child windows used for navigation
            RECT rect;

            GetClientRect(hWnd, &rect);

            CefWindowInfo info;
            CefBrowserSettings browser_settings;
            browser_settings.universal_access_from_file_urls = STATE_ENABLED;
//            browser_settings.file_access_from_file_urls = STATE_ENABLED;
            browser_settings.web_security = STATE_DISABLED;
            browser_settings.local_storage = STATE_ENABLED;
            browser_settings.application_cache = STATE_DISABLED;
            browser_settings.javascript_open_windows = STATE_DISABLED;
//            browser_settings.accelerated_compositing = STATE_DISABLED;
            
            // Initialize window info to the defaults for a child window
            info.SetAsChild(hWnd, rect);

            // Create the new child browser window
            wstring URL(L"file:///stub.html?" + AppGetCommandLine()->GetSwitchValue("querystring").ToWString());
            if (AppGetCommandLine()->HasSwitch("yid"))
            {
                URL += L"&yid=" + ExtractYID(AppGetCommandLine()->GetSwitchValue("yid").ToWString());
            }
            //  TODO:  Can we just use the same window handler (assuming we get rid of the globals and add some sync)?
            CefRefPtr<CefBrowser> browser = CefBrowserHost::CreateBrowserSync(info, app->m_WindowHandler[mainUUID].get(), URL, browser_settings, NULL);
            app->m_WindowHandler[mainUUID]->m_MainBrowser = browser;
            mainWinBrowser = browser;

            app->hwndRender = hWnd; // setup current handle to use in Show/HideWindow
        
            CefRefPtr<CefProcessMessage> process_message = CefProcessMessage::Create("setHandle");
            process_message->GetArgumentList()->SetInt(0, reinterpret_cast<int>(hWnd));
            browser->SendProcessMessage(PID_RENDERER, process_message);

            // Send the main window creation start time to the renderer
            process_message = CefProcessMessage::Create("mainWindowCreationTime");
            CefRefPtr<CefBinaryValue> startTime = CefBinaryValue::Create(&beginMainWindowCreationTime, sizeof(CefTime));
            process_message->GetArgumentList()->SetBinary(0, startTime);
            browser->SendProcessMessage(PID_RENDERER, process_message);

            if (bufferSize)
            {
                process_message = CefProcessMessage::Create("lala");
                process_message->GetArgumentList()->SetString(0, buff);
                browser->SendProcessMessage(PID_RENDERER, process_message);
            }

            SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(new WindowExtras));

            SetTimer(hWnd, IDLETIMER, IdleTimerPollIntervalMS, NULL);
            SetTimer(hWnd, NETWORKTIMER, NetworkTimerPollIntervalMS, NULL);

            return 0;
        }

        case WM_MOVE:
//.........这里部分代码省略.........
开发者ID:sfrancisx,项目名称:Caffeine,代码行数:101,代码来源:MainWindow.cpp

示例15: WndProc


//.........这里部分代码省略.........
                                hInst, 0);
      x += BUTTON_WIDTH;

      stopWnd = CreateWindow(L"BUTTON", L"Stop",
                              WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
                              | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
                              hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
      x += BUTTON_WIDTH;

      editWnd = CreateWindow(L"EDIT", 0,
                              WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
                              ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
                              x, 0, rect.right - BUTTON_WIDTH * 4,
                              URLBAR_HEIGHT, hWnd, 0, hInst, 0);

      // Assign the edit window's WNDPROC to this function so that we can
      // capture the enter key
      editWndOldProc =
          reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
      SetWindowLongPtr(editWnd, GWLP_WNDPROC,
          reinterpret_cast<LONG_PTR>(WndProc));
      g_handler->SetEditHwnd(editWnd);
      g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);

      rect.top += URLBAR_HEIGHT;

      CefWindowInfo info;
      CefBrowserSettings settings;

      // Populate the settings based on command line arguments.
      AppGetBrowserSettings(settings);

      // Initialize window info to the defaults for a child window
      info.SetAsChild(hWnd, rect);

      // Creat the new child browser window
      CefBrowser::CreateBrowser(info,
          static_cast<CefRefPtr<CefClient> >(g_handler),
          g_handler->GetStartupURL(), settings);

      return 0;
    }

    case WM_COMMAND: {
      CefRefPtr<CefBrowser> browser;
      if (g_handler.get())
        browser = g_handler->GetBrowser();

      wmId    = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId) {
      case IDM_ABOUT:
        DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
        return 0;
      case IDM_EXIT:
        DestroyWindow(hWnd);
        return 0;
      case ID_WARN_CONSOLEMESSAGE:
        if (g_handler.get()) {
          std::wstringstream ss;
          ss << L"Console messages will be written to "
              << std::wstring(CefString(g_handler->GetLogFile()));
          MessageBox(hWnd, ss.str().c_str(), L"Console Messages",
              MB_OK | MB_ICONINFORMATION);
        }
开发者ID:hernad,项目名称:CEF3_windows_build,代码行数:67,代码来源:cefclient_win.cpp


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