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

Method GetWindowClass

SampleApps/WebView2APISample/AppWindow.cpp:307–334  ·  view source on GitHub ↗

Register the Win32 window class for the app window.

Source from the content-addressed store, hash-verified

305
306// Register the Win32 window class for the app window.
307PCWSTR AppWindow::GetWindowClass()
308{
309 // Only do this once
310 static PCWSTR windowClass = []
311 {
312 static WCHAR windowClass[s_maxLoadString];
313 LoadStringW(g_hInstance, IDC_WEBVIEW2APISAMPLE, windowClass, s_maxLoadString);
314
315 WNDCLASSEXW wcex;
316 wcex.cbSize = sizeof(WNDCLASSEX);
317
318 wcex.style = CS_HREDRAW | CS_VREDRAW;
319 wcex.lpfnWndProc = WndProcStatic;
320 wcex.cbClsExtra = 0;
321 wcex.cbWndExtra = 0;
322 wcex.hInstance = g_hInstance;
323 wcex.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_WEBVIEW2APISAMPLE));
324 wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
325 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
326 wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WEBVIEW2APISAMPLE);
327 wcex.lpszClassName = windowClass;
328 wcex.hIconSm = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_WEBVIEW2APISAMPLE));
329
330 RegisterClassExW(&wcex);
331 return windowClass;
332 }();
333 return windowClass;
334}
335
336LRESULT CALLBACK AppWindow::WndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
337{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected