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

Class FileComponent

SampleApps/WebView2APISample/FileComponent.h:15–42  ·  view source on GitHub ↗

This component handles commands from the File menu, except for Exit. It also handles the DocumentTitleChanged event.

Source from the content-addressed store, hash-verified

13// This component handles commands from the File menu, except for Exit.
14// It also handles the DocumentTitleChanged event.
15class FileComponent : public ComponentBase
16{
17public:
18 FileComponent(AppWindow* appWindow);
19
20 bool HandleWindowMessage(
21 HWND hWnd,
22 UINT message,
23 WPARAM wParam,
24 LPARAM lParam,
25 LRESULT* result) override;
26
27 void SaveScreenshot();
28 void PrintToPdf(bool enableLandscape);
29 bool IsPrintToPdfInProgress();
30
31 ~FileComponent() override;
32
33private:
34 OPENFILENAME CreateOpenFileName(LPWSTR defaultName, LPCWSTR filter);
35
36 AppWindow* m_appWindow = nullptr;
37 wil::com_ptr<ICoreWebView2> m_webView;
38 bool m_printToPdfInProgress = false;
39 bool m_enableLandscape = false;
40
41 EventRegistrationToken m_documentTitleChangedToken = {};
42};
43

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected