Mercurial > dwindows
annotate win/edge.cpp @ 2000:77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
Win: Fixes to the last commit for embedding chromium based Edge.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 31 Oct 2019 08:26:58 +0000 |
parents | 4e808c4cadfb |
children | f7acca46f795 |
rev | line source |
---|---|
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* edge.cpp |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 * |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 * Allows dw_html_new() to embed a Microsoft Edge (Chromium) browser. |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 * |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 * Requires Windows 10, 8 or 7 with Microsoft Edge (Chromium) installed. |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 * |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 * Only included when BUILD_EDGE is defined, will fall back to embedded IE. |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 * |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 * Currently only buildable with Visual Studio since it requires the EDGE |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 * SDK which is currently distributed as a nuget package. |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 */ |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #include "dw.h" |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #include "webview2.h" |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
14 #include <wrl.h> |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
15 |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
16 using namespace Microsoft::WRL; |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
18 #define _DW_HTML_DATA_NAME (char *)"_dw_edge" |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
20 extern "C" { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
21 |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
22 BOOL _dw_edge_detect(VOID) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
23 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
24 return TRUE; |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
25 } |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
27 /******************************* dw_html_action() ************************** |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
28 * Implements the functionality of a "Back". "Forward", "Home", "Search", |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
29 * "Refresh", or "Stop" button. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
30 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
31 * hwnd = Handle to the window hosting the browser object. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
32 * action = One of the following: |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
33 * 0 = Move back to the previously viewed web page. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
34 * 1 = Move forward to the previously viewed web page. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
35 * 2 = Move to the home page. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
36 * 3 = Search. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
37 * 4 = Refresh the page. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
38 * 5 = Stop the currently loading page. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
39 */ |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
41 void _dw_edge_action(HWND hwnd, int action) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
42 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
43 IWebView2WebView* webview; |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
45 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
46 // we initially attached the browser object to this window. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
47 webview = (IWebView2WebView*)dw_window_get_data(hwnd, _DW_HTML_DATA_NAME); |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
48 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
49 // We want to get the base address (ie, a pointer) to the IWebView2WebView object embedded within the browser |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
50 // object, so we can call some of the functions in the former's table. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
51 if (webview) |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
52 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
53 // Call the desired function |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
54 switch (action) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
55 { |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 case DW_HTML_GOBACK: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
58 // Call the IWebView2WebView object's GoBack function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 webview->GoBack(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 break; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 case DW_HTML_GOFORWARD: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
65 // Call the IWebView2WebView object's GoForward function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 webview->GoForward(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 break; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 case DW_HTML_GOHOME: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
72 // Call the IWebView2WebView object's GoHome function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 //webview->GoHome(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 break; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 case DW_HTML_SEARCH: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
78 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
79 // Call the IWebView2WebView object's GoSearch function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 //webview->GoSearch(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 break; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
84 case DW_HTML_RELOAD: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
85 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
86 // Call the IWebView2WebView object's Refresh function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 webview->Reload(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
88 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 case DW_HTML_STOP: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
92 // Call the IWebView2WebView object's Stop function. |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 //webview->Stop(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 } |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
95 } |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 } |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
98 |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
99 /******************************* dw_html_raw() **************************** |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
100 * Takes a string containing some HTML BODY, and displays it in the specified |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
101 * window. For example, perhaps you want to display the HTML text of... |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
102 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
103 * <P>This is a picture.<P><IMG src="mypic.jpg"> |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
104 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
105 * hwnd = Handle to the window hosting the browser object. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
106 * string = Pointer to nul-terminated string containing the HTML BODY. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
107 * (NOTE: No <BODY></BODY> tags are required in the string). |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
108 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
109 * RETURNS: 0 if success, or non-zero if an error. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
110 */ |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
112 int _dw_edge_raw(HWND hwnd, LPCWSTR string) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
113 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
114 IWebView2WebView* webview; |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
116 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
117 // we initially attached the browser object to this window. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
118 webview = (IWebView2WebView*)dw_window_get_data(hwnd, _DW_HTML_DATA_NAME); |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
119 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
120 if (webview) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
121 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
122 return DW_ERROR_NONE; |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
123 } |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
124 return DW_ERROR_UNKNOWN; |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
125 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
126 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
127 /******************************* dw_html_url() **************************** |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
128 * Displays a URL, or HTML file on disk. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
129 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
130 * hwnd = Handle to the window hosting the browser object. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
131 * webPageName = Pointer to nul-terminated name of the URL/file. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
132 * |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
133 * RETURNS: 0 if success, or non-zero if an error. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
134 */ |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
135 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
136 int _dw_edge_url(HWND hwnd, LPCWSTR url) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
137 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
138 IWebView2WebView* webview; |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
139 |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
140 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
141 // we initially attached the browser object to this window. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
142 webview = (IWebView2WebView*)dw_window_get_data(hwnd, _DW_HTML_DATA_NAME); |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
143 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
144 if (webview) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
145 { |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
146 webview->Navigate(url); |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
147 return DW_ERROR_NONE; |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
148 } |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
149 return DW_ERROR_UNKNOWN; |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
150 } |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
151 |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
152 /************************** browserWindowProc() ************************* |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
153 * Our message handler for our window to host the browser. |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
154 */ |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
155 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
156 LRESULT CALLBACK _edgeWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
157 { |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
158 switch (uMsg) |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
159 { |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
160 case WM_SIZE: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
161 { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
162 // Resize the browser object to fit the window |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
163 RECT bounds; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
164 IWebView2WebView* webview; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
165 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
166 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
167 // we initially attached the browser object to this window. |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
168 webview = (IWebView2WebView*)dw_window_get_data(hWnd, _DW_HTML_DATA_NAME); |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
169 GetClientRect(hWnd, &bounds); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
170 // Resize WebView to fit the bounds of the parent window |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
171 if (webview) |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
172 webview->put_Bounds(bounds); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
173 return(0); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
174 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
175 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
176 case WM_CREATE: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
177 { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
178 // Step 3 - Create a single WebView within the parent window |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
179 // Locate the browser and set up the environment for WebView |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
180 CreateWebView2EnvironmentWithDetails(nullptr, nullptr, nullptr, |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
181 Callback<IWebView2CreateWebView2EnvironmentCompletedHandler>( |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
182 [hWnd](HRESULT result, IWebView2Environment* env) -> HRESULT { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
183 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
184 // Create a WebView, whose parent is the main window hWnd |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
185 env->CreateWebView(hWnd, Callback<IWebView2CreateWebViewCompletedHandler>( |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
186 [hWnd](HRESULT result, IWebView2WebView* webview) -> HRESULT { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
187 if (webview != nullptr) { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
188 dw_window_set_data(hWnd, _DW_HTML_DATA_NAME, DW_POINTER(webview)); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
189 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
190 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
191 // Add a few settings for the webview |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
192 // this is a redundant demo step as they are the default settings values |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
193 IWebView2Settings* Settings; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
194 webview->get_Settings(&Settings); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
195 Settings->put_IsScriptEnabled(TRUE); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
196 Settings->put_AreDefaultScriptDialogsEnabled(TRUE); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
197 Settings->put_IsWebMessageEnabled(TRUE); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
198 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
199 // Resize WebView to fit the bounds of the parent window |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
200 RECT bounds; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
201 GetClientRect(hWnd, &bounds); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
202 webview->put_Bounds(bounds); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
203 return S_OK; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
204 }).Get()); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
205 return S_OK; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
206 }).Get()); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
207 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
208 // Success |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
209 return(0); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
212 case WM_DESTROY: |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
213 { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
214 // Detach the browser object from this window, and free resources. |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
215 IWebView2WebView* webview; |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
216 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
217 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
218 // we initially attached the browser object to this window. |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
219 webview = (IWebView2WebView*)dw_window_get_data(hWnd, _DW_HTML_DATA_NAME); |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
220 if (webview) |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
221 { |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
222 dw_window_set_data(hWnd, _DW_HTML_DATA_NAME, NULL); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
223 webview->Close(); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
225 } |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 return(TRUE); |
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
227 } |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
228 } |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
229 |
2000
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
230 return(DefWindowProc(hWnd, uMsg, wParam, lParam)); |
77e43d71eaa7
Changes to allow mixing C and C++ when including dw.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
1999
diff
changeset
|
231 } |
1999
4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
232 } |