Mercurial > dwindows
comparison win/edge.cpp @ 2124:f9a2fc59611c
Win: That last fix wasn't tested enough. Create a subfolder with the AppID.
The previous fix only allowed one dwindows application instance access to Edge.
Create a subdirectory under TEMP with the specified or auto-detected ID.
This change made me pull the application ID code out of #ifdef BUILD_TOAST.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 25 Jun 2020 00:38:37 +0000 |
parents | 589896c07c91 |
children | 663467f6eee4 |
comparison
equal
deleted
inserted
replaced
2123:589896c07c91 | 2124:f9a2fc59611c |
---|---|
28 | 28 |
29 class EdgeBrowser | 29 class EdgeBrowser |
30 { | 30 { |
31 public: | 31 public: |
32 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); | 32 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); |
33 BOOL Detect(VOID); | 33 BOOL Detect(LPWSTR AppID); |
34 protected: | 34 protected: |
35 Microsoft::WRL::ComPtr<ICoreWebView2Environment> Env; | 35 Microsoft::WRL::ComPtr<ICoreWebView2Environment> Env; |
36 }; | 36 }; |
37 | 37 |
38 class EdgeWebView | 38 class EdgeWebView |
222 WebHost->get_IsVisible(&isVisible); | 222 WebHost->get_IsVisible(&isVisible); |
223 if(!isVisible) | 223 if(!isVisible) |
224 WebHost->put_IsVisible(TRUE); | 224 WebHost->put_IsVisible(TRUE); |
225 } | 225 } |
226 | 226 |
227 BOOL EdgeBrowser::Detect(VOID) | 227 BOOL EdgeBrowser::Detect(LPWSTR AppID) |
228 { | 228 { |
229 WCHAR tempdir[MAX_PATH+1]; | 229 WCHAR tempdir[MAX_PATH+1] = {0}; |
230 | 230 |
231 GetTempPathW(MAX_PATH, tempdir); | 231 GetTempPathW(MAX_PATH, tempdir); |
232 wcscat(tempdir, AppID); | |
233 wcscat(tempdir, L"\\"); | |
234 CreateDirectoryW(tempdir, NULL); | |
232 | 235 |
233 CreateCoreWebView2EnvironmentWithOptions(nullptr, tempdir, nullptr, | 236 CreateCoreWebView2EnvironmentWithOptions(nullptr, tempdir, nullptr, |
234 Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( | 237 Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( |
235 [this](HRESULT result, ICoreWebView2Environment* env) -> HRESULT { | 238 [this](HRESULT result, ICoreWebView2Environment* env) -> HRESULT { |
236 // Successfully created Edge environment, return TRUE | 239 // Successfully created Edge environment, return TRUE |
357 /******************************* dw_edge_detect() ************************** | 360 /******************************* dw_edge_detect() ************************** |
358 * Attempts to create a temporary Edge (Chromium) browser context... | 361 * Attempts to create a temporary Edge (Chromium) browser context... |
359 * If we succeed return TRUE and use Edge for HTML windows. | 362 * If we succeed return TRUE and use Edge for HTML windows. |
360 * If it fails return FALSE and fall back to using embedded IE. | 363 * If it fails return FALSE and fall back to using embedded IE. |
361 */ | 364 */ |
362 BOOL _dw_edge_detect(VOID) | 365 BOOL _dw_edge_detect(LPWSTR AppID) |
363 { | 366 { |
364 DW_EDGE = new EdgeBrowser; | 367 DW_EDGE = new EdgeBrowser; |
365 if (DW_EDGE) | 368 if (DW_EDGE) |
366 { | 369 { |
367 BOOL result = DW_EDGE->Detect(); | 370 BOOL result = DW_EDGE->Detect(AppID); |
368 if (!result) | 371 if (!result) |
369 { | 372 { |
370 delete DW_EDGE; | 373 delete DW_EDGE; |
371 DW_EDGE = NULL; | 374 DW_EDGE = NULL; |
372 } | 375 } |