This commit is contained in:
2022-10-04 12:58:15 -04:00
parent cb6be1e183
commit 359af6326b
2 changed files with 19 additions and 11 deletions

3
.gitignore vendored
View File

@@ -57,4 +57,5 @@ UpgradeLog.XML
*.db *.db
#Redist #Redist
!Installer/Redist/* !Installer/Redist/*
UpgradeLog.htm

View File

@@ -1,13 +1,14 @@
#include "DataModelV2/LevelInstance.h" #include "DataModelV2/LevelInstance.h"
#include "Globals.h" #include "Globals.h"
#include "SplashHTML.h" #include "SplashHTML.h"
#include "Application.h"
#include <windows.h> #include <windows.h>
#include <MsHTML.h> #include <MsHTML.h>
#include <Exdisp.h> #include <Exdisp.h>
#include <ExDispid.h> #include <ExDispid.h>
#include <shlwapi.h> #include <shlwapi.h>
void SplashHTMLContainer() HWND SplashHTMLContainer()
{ {
HWND invisWindowHandle = CreateWindowEx(WS_EX_TOOLWINDOW, HWND invisWindowHandle = CreateWindowEx(WS_EX_TOOLWINDOW,
"htmlWindow", "htmlWindow",
@@ -24,10 +25,13 @@ void SplashHTMLContainer()
printf("Creating Window HWND: %u\n", invisWindowHandle); printf("Creating Window HWND: %u\n", invisWindowHandle);
ShowWindow(invisWindowHandle, 1); ShowWindow(invisWindowHandle, 1);
UpdateWindow(invisWindowHandle); UpdateWindow(invisWindowHandle);
return invisWindowHandle;
} }
int SplashHTMLLoad(std::string strHTML) void PH()
//int SplashHTMLLoad(std::string strHTML)
{ {
IHTMLDocument2 *document = new IHTMLDocument2{}; // Declared earlier in the code SplashHTMLContainer();
IHTMLDocument2 *document; // Declared earlier in the code
BSTR bstr = SysAllocString(OLESTR("Written by IHTMLDocument2::write().")); BSTR bstr = SysAllocString(OLESTR("Written by IHTMLDocument2::write()."));
// Creates a new one-dimensional array // Creates a new one-dimensional array
SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1);
@@ -39,20 +43,19 @@ int SplashHTMLLoad(std::string strHTML)
param->vt = VT_BSTR; param->vt = VT_BSTR;
param->bstrVal = bstr; param->bstrVal = bstr;
hr = SafeArrayUnaccessData(psaStrings); hr = SafeArrayUnaccessData(psaStrings);
hr = document->write(psaStrings); //hr = document->write(psaStrings);
cleanup: cleanup:
// SafeArrayDestroy calls SysFreeString for each BSTR // SafeArrayDestroy calls SysFreeString for each BSTR
if (psaStrings != NULL) { if (psaStrings != NULL) {
SafeArrayDestroy(psaStrings); SafeArrayDestroy(psaStrings);
} }
return 0;
} }
int PLACEHOLDER(std::wstring strHTML) int SplashHTMLLoad(std::string strHTML)
{ {
//CreateHTMLContainer(); HWND splashContainer = SplashHTMLContainer();
printf("%s \n", strHTML.c_str());
CoInitialize(NULL);
SHANDLE_PTR browserHWND;
HWND parentResultSplash;
HRESULT InstanciateIEResult; HRESULT InstanciateIEResult;
HRESULT NavigateResult; HRESULT NavigateResult;
HRESULT ShowBrowserResult; HRESULT ShowBrowserResult;
@@ -69,7 +72,7 @@ int PLACEHOLDER(std::wstring strHTML)
if (browser) if (browser)
{ {
BSTR URL = SysAllocString(L"about:blank"); BSTR URL = SysAllocString(L"http://google.com");
browser->put_AddressBar(false); browser->put_AddressBar(false);
browser->put_ToolBar(false); browser->put_ToolBar(false);
browser->put_TheaterMode(false); browser->put_TheaterMode(false);
@@ -78,10 +81,14 @@ int PLACEHOLDER(std::wstring strHTML)
browser->Navigate(URL, &empty, &empty, &empty, &empty); browser->Navigate(URL, &empty, &empty, &empty, &empty);
SysFreeString(URL); SysFreeString(URL);
ShowBrowserResult = browser->get_HWND(&browserHWND);
ShowBrowserResult = browser->put_Visible(VARIANT_TRUE); ShowBrowserResult = browser->put_Visible(VARIANT_TRUE);
browser->Release(); browser->Release();
parentResultSplash = SetParent((HWND)&browserHWND, splashContainer);
} }
printf("%s \n%u \n%u \n", strHTML.c_str(), (HWND)&browserHWND, parentResultSplash);
CoUninitialize(); CoUninitialize();
return 0; return 0;
} }