forked from MicrosoftEdge/WebView2Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppWindow.h
More file actions
65 lines (51 loc) · 1.74 KB
/
AppWindow.h
File metadata and controls
65 lines (51 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "pch.h"
#include "framework.h"
#include <regex>
using namespace Microsoft::WRL;
#define MAX_LOADSTRING 100
class CompositionHost;
class AppWindow
{
public:
AppWindow();
ICoreWebView2Controller* GetWebViewController()
{
return m_controller.get();
}
ICoreWebView2CompositionController* GetWebViewCompositionController()
{
return m_compositionController.get();
}
ICoreWebView2* GetWebView()
{
return m_webView.get();
}
HWND GetMainWindow()
{
return m_mainWindow;
}
private:
static LRESULT CALLBACK
WndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
static PCWSTR GetWindowClass();
bool HandleWindowMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void InitializeWebView();
HRESULT OnCreateCoreWebView2ControllerCompleted(
HRESULT result, ICoreWebView2CompositionController* compositionController);
void CloseWebView();
void CloseAppWindow();
std::wstring GetLocalUri(std::wstring relativePath);
std::wstring GetLocalPath(std::wstring relativePath, bool keep_exe_path);
HWND m_mainWindow = nullptr;
std::unique_ptr<CompositionHost> m_winComp;
wil::com_ptr<ICoreWebView2Environment> m_webViewEnvironment;
wil::com_ptr<ICoreWebView2CompositionController> m_compositionController;
wil::com_ptr<ICoreWebView2Controller> m_controller;
wil::com_ptr<ICoreWebView2> m_webView;
std::wstring m_sampleUri;
};