MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Browser / WndProc

Method WndProc

BrowserWindow.cpp:78–132  ·  view source on GitHub ↗

FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) PURPOSE: Processes messages for each browser window instance. WM_COMMAND - process the application menu WM_PAINT - Paint the main window WM_DESTROY - post a quit message and return

Source from the content-addressed store, hash-verified

76//
77//
78LRESULT CALLBACK BrowserWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
79{
80
81 switch (message)
82 {
83 case WM_GETMINMAXINFO:
84 {
85 MINMAXINFO* minmax = reinterpret_cast<MINMAXINFO*>(lParam);
86 minmax->ptMinTrackSize.x = m_minWindowWidth;
87 minmax->ptMinTrackSize.y = m_minWindowHeight;
88 }
89 break;
90 case WM_DPICHANGED:
91 {
92 UpdateMinWindowSize();
93 }
94 case WM_SIZE:
95 {
96 ResizeUIWebViews();
97 if (m_tabs.find(m_activeTabId) != m_tabs.end())
98 {
99 m_tabs.at(m_activeTabId)->ResizeWebView();
100 }
101 }
102 break;
103 case WM_CLOSE:
104 {
105 web::json::value jsonObj = web::json::value::parse(L"{}");
106 jsonObj[L"message"] = web::json::value(MG_CLOSE_WINDOW);
107 jsonObj[L"args"] = web::json::value::parse(L"{}");
108
109 CheckFailure(PostJsonToWebView(jsonObj, m_controlsWebView.Get()), L"Try again.");
110 }
111 break;
112 case WM_NCDESTROY:
113 {
114 SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);
115 delete this;
116 PostQuitMessage(0);
117 }
118 case WM_PAINT:
119 {
120 PAINTSTRUCT ps;
121 HDC hdc = BeginPaint(hWnd, &ps);
122 EndPaint(hWnd, &ps);
123 }
124 break;
125 default:
126 {
127 return DefWindowProc(hWnd, message, wParam, lParam);
128 }
129 break;
130 }
131 return 0;
132}
133
134
135BOOL BrowserWindow::LaunchWindow(_In_ HINSTANCE hInstance, _In_ int nCmdShow)

Callers 1

WndProcStaticMethod · 0.80

Calls 1

ResizeWebViewMethod · 0.80

Tested by

no test coverage detected