MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / AppWindow

Class AppWindow

SampleApps/WebView2SampleWinComp/AppWindow.h:17–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15class CompositionHost;
16
17class AppWindow
18{
19public:
20 AppWindow();
21
22 ICoreWebView2Controller* GetWebViewController()
23 {
24 return m_controller.get();
25 }
26
27 ICoreWebView2CompositionController* GetWebViewCompositionController()
28 {
29 return m_compositionController.get();
30 }
31
32 ICoreWebView2* GetWebView()
33 {
34 return m_webView.get();
35 }
36
37 HWND GetMainWindow()
38 {
39 return m_mainWindow;
40 }
41
42private:
43 static LRESULT CALLBACK
44 WndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
45 static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
46 static PCWSTR GetWindowClass();
47
48 bool HandleWindowMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
49 void InitializeWebView();
50 HRESULT OnCreateCoreWebView2ControllerCompleted(
51 HRESULT result, ICoreWebView2CompositionController* compositionController);
52 void CloseWebView();
53 void CloseAppWindow();
54 std::wstring GetLocalUri(std::wstring relativePath);
55 std::wstring GetLocalPath(std::wstring relativePath, bool keep_exe_path);
56
57 HWND m_mainWindow = nullptr;
58 std::unique_ptr<CompositionHost> m_winComp;
59
60 wil::com_ptr<ICoreWebView2Environment> m_webViewEnvironment;
61 wil::com_ptr<ICoreWebView2CompositionController> m_compositionController;
62 wil::com_ptr<ICoreWebView2Controller> m_controller;
63 wil::com_ptr<ICoreWebView2> m_webView;
64 std::wstring m_sampleUri;
65};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected