diff --git a/SplashHTML.cpp b/SplashHTML.cpp index a152e08..82f6c41 100644 --- a/SplashHTML.cpp +++ b/SplashHTML.cpp @@ -7,27 +7,47 @@ #include #include -int SplashHTMLLoad(std::string strHTML) -//void CreateHTMLContainer() +void SplashHTMLContainer() { - HWND NewWindow = CreateWindowEx( - WS_EX_TOOLWINDOW, - "", - "", - WS_OVERLAPPEDWINDOW|WS_VISIBLE, - 0, - 0, - 500, - 300, - 0, - 0, - HINSTANCE(NULL), - NULL); - ShowWindow(NewWindow, 1); - UpdateWindow(NewWindow); + HWND invisWindowHandle = CreateWindowEx(WS_EX_TOOLWINDOW, + "htmlWindow", + "Splash", + WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_THICKFRAME, + 200, + 200, + 500, + 300, + NULL, + NULL, + NULL, + NULL); + printf("Creating Window HWND: %u\n", invisWindowHandle); + ShowWindow(invisWindowHandle, 1); + UpdateWindow(invisWindowHandle); +} +int SplashHTMLLoad(std::string strHTML) +{ + IHTMLDocument2 *document = new IHTMLDocument2{}; // Declared earlier in the code + BSTR bstr = SysAllocString(OLESTR("Written by IHTMLDocument2::write().")); + // Creates a new one-dimensional array + SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); + if (psaStrings == NULL) { + goto cleanup; + } + VARIANT *param; + HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m); + param->vt = VT_BSTR; + param->bstrVal = bstr; + hr = SafeArrayUnaccessData(psaStrings); + hr = document->write(psaStrings); +cleanup: + // SafeArrayDestroy calls SysFreeString for each BSTR + if (psaStrings != NULL) { + SafeArrayDestroy(psaStrings); + } return 0; } -int SplashHTMLLoadz(std::string strHTML) +int PLACEHOLDER(std::wstring strHTML) { //CreateHTMLContainer(); printf("%s \n", strHTML.c_str()); diff --git a/SplashHTML.h b/SplashHTML.h index 0de1ce3..aa49e88 100644 --- a/SplashHTML.h +++ b/SplashHTML.h @@ -1,2 +1,3 @@ #include -int SplashHTMLLoad(std::string); +//int SplashHTMLLoad(std::string strHTML); +int SplashHTMLLoad(std::string strHTML); \ No newline at end of file diff --git a/src/source/main.cpp b/src/source/main.cpp index 40ec0d4..fba0d8d 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -20,6 +20,11 @@ DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; EXCEPINFO excepinfo; UINT nArgErr; +LRESULT CALLBACK HtmlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return DefWindowProc(hwnd, msg, wParam, lParam); +} + LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA); @@ -184,6 +189,8 @@ int main(int argc, char** argv) { settings.window.center = true; */ HMODULE hThisInstance = GetModuleHandle(NULL); + if (!createWindowClass("htmlWindow",HtmlProc,NULL)) + return false; if (!createWindowClass("mainHWND",WndProc,hThisInstance)) return false; if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))