diff --git a/samples/gfx_html/browser_win.h b/samples/gfx_html/browser_win.h index 0f26a0cc6d..54628d711c 100644 --- a/samples/gfx_html/browser_win.h +++ b/samples/gfx_html/browser_win.h @@ -1,10 +1,9 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by vboxhtmlgfx_win.rc +// Used by browser_win.rc // -#define IDD_BROWSER 101 -#define IDC_IE 1000 +#define IDI_ICON 100 // Next default values for new objects // diff --git a/samples/gfx_html/browser_win.rc b/samples/gfx_html/browser_win.rc index 35b7fca050..0089aa458a 100644 --- a/samples/gfx_html/browser_win.rc +++ b/samples/gfx_html/browser_win.rc @@ -27,6 +27,22 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Icon // +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON "res\\boinc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// HTML +// +default_win.htm HTML "res\\default_win.htm" +boinc.png HTML "res\\boinc.png" +virtualbox.png HTML "res\\virtualbox.png" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// ///////////////////////////////////////////////////////////////////////////// // @@ -58,7 +74,7 @@ BEGIN VALUE "FileDescription", "BOINC HTML Graphics" VALUE "FileVersion", VER_TOSTR(BOINC_MAJOR_VERSION, BOINC_MINOR_VERSION, WRAPPER_RELEASE) VALUE "InternalName", "htmlgfx" - VALUE "LegalCopyright", "© 2011-2014 University of California" + VALUE "LegalCopyright", "© 2011-2015 University of California" VALUE "OriginalFilename", "htmlgfx.exe" VALUE "ProductName", "BOINC HTML Graphics" VALUE "ProductVersion", VER_TOSTR(BOINC_MAJOR_VERSION, BOINC_MINOR_VERSION, WRAPPER_RELEASE) @@ -70,11 +86,6 @@ BEGIN END END -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - ///////////////////////////////////////////////////////////////////////////// // // String Table diff --git a/samples/gfx_html/browserctrl_win.cpp b/samples/gfx_html/browserctrl_win.cpp index 71502e5533..be3f8e0c15 100644 --- a/samples/gfx_html/browserctrl_win.cpp +++ b/samples/gfx_html/browserctrl_win.cpp @@ -50,8 +50,6 @@ CWndClassInfo& CHTMLBrowserHost::GetWndClassInfo() HWND CHTMLBrowserHost::Create( HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, LPVOID lpCreateParam ){ - HWND hWnd; - ATOM atom = GetWndClassInfo().Register(&m_pfnSuperWindowProc); if (!atom) return NULL; @@ -76,28 +74,15 @@ HWND CHTMLBrowserHost::Create( } // create window - hWnd = CWindow::Create((LPCTSTR)atom, hWndParent, rect, szWindowName, dwStyle, dwExStyle, MenuOrID, lpCreateParam); - - // register external dispatch - SetExternalDispatch((IHTMLBrowserHostUI*)this); - - return hWnd; + return CWindow::Create((LPCTSTR)atom, hWndParent, rect, szWindowName, dwStyle, dwExStyle, MenuOrID, lpCreateParam); } void CHTMLBrowserHost::FinalRelease() { - SetExternalDispatch(NULL); ReleaseAll(); } -STDMETHODIMP CHTMLBrowserHost::Log( - VARIANT* pvaLog -){ - browserlog_msg("%S", pvaLog->bstrVal); - return S_OK; -} - STDMETHODIMP CHTMLBrowserHost::ShowMessage( HWND hwnd, LPOLESTR lpstrText, LPOLESTR lpstrCaption, DWORD dwType, LPOLESTR lpstrHelpFile, DWORD dwHelpContext, LRESULT *plResult ){ diff --git a/samples/gfx_html/browserctrl_win.h b/samples/gfx_html/browserctrl_win.h index cf8f1bfe33..34faa48c16 100644 --- a/samples/gfx_html/browserctrl_win.h +++ b/samples/gfx_html/browserctrl_win.h @@ -18,24 +18,13 @@ #ifndef _BROWSERCTRL_WIN_H_ #define _BROWSERCTRL_WIN_H_ -///////////////////////////////////////////////////////////////////////////// -// IBrowserHostUI interface - -MIDL_INTERFACE("A7275E6E-DE3D-4107-B34F-C4C28411A6F0") -IHTMLBrowserHostUI : public IDispatch -{ -public: - virtual HRESULT STDMETHODCALLTYPE Log(VARIANT* pvaLog) = 0; -}; - ///////////////////////////////////////////////////////////////////////////// // CHTMLBrowserHost class class ATL_NO_VTABLE CHTMLBrowserHost : public CAxHostWindow, public IDocHostShowUI, - public IOleCommandTarget, - public IDispatchImpl + public IOleCommandTarget { public: DECLARE_NO_REGISTRY() @@ -44,7 +33,6 @@ public: DECLARE_GET_CONTROLLING_UNKNOWN() BEGIN_COM_MAP(CHTMLBrowserHost) - COM_INTERFACE_ENTRY(IHTMLBrowserHostUI) COM_INTERFACE_ENTRY(IDocHostShowUI) COM_INTERFACE_ENTRY(IOleCommandTarget) COM_INTERFACE_ENTRY_CHAIN(CAxHostWindow) @@ -58,12 +46,6 @@ public: void FinalRelease(); - // COM Interface - IHTMLBrowserHostUI - // Provide a basic set of services to HTML based applications - // - STDMETHOD(Log)(VARIANT* pvaLog); - - // COM Interface - IDocHostShowUI // http://msdn.microsoft.com/en-us/library/aa770041(v=vs.85).aspx // @@ -76,7 +58,6 @@ public: // STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText); STDMETHOD(Exec)(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG* pvaIn, VARIANTARG* pvaOut); - }; #endif \ No newline at end of file diff --git a/samples/gfx_html/browserwnd_win.cpp b/samples/gfx_html/browserwnd_win.cpp index 7d8fbf6ec7..883b0d04f1 100644 --- a/samples/gfx_html/browserwnd_win.cpp +++ b/samples/gfx_html/browserwnd_win.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "win_util.h" #include "version.h" @@ -38,22 +39,61 @@ #include "browserwnd_win.h" +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + + CHTMLBrowserWnd::CHTMLBrowserWnd() { m_pBrowserHost = NULL; + m_hIcon = NULL; + m_hIconSmall = NULL; } CHTMLBrowserWnd::~CHTMLBrowserWnd() { + if(m_hIcon) + { + ::DestroyIcon(m_hIcon); + m_hIcon = NULL; + } + + if(m_hIconSmall) + { + ::DestroyIcon(m_hIconSmall); + m_hIconSmall = NULL; + } } LRESULT CHTMLBrowserWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { HRESULT hr; RECT rcClient; + TCHAR szExecutable[MAX_PATH]; CComPtr pCtrl; CComVariant v; + // Load Icon Resources + m_hIcon = (HICON)::LoadImage( + _AtlBaseModule.GetResourceInstance(), + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + 0, 0, + LR_DEFAULTSIZE | LR_DEFAULTCOLOR); + ATLASSERT(m_hIcon); + + m_hIconSmall = (HICON)::LoadImage( + _AtlBaseModule.GetResourceInstance(), + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + ::GetSystemMetrics(SM_CXSMICON), + ::GetSystemMetrics(SM_CYSMICON), + LR_DEFAULTCOLOR); + ATLASSERT(m_hIconSmall); + + SetIcon(m_hIcon); + SetIcon(m_hIconSmall, FALSE); // Create Control Host hr = CComObject::CreateInstance(&m_pBrowserHost); @@ -78,7 +118,15 @@ LRESULT CHTMLBrowserWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& m_pBrowserCtrl = pCtrl; if (m_pBrowserCtrl) { - m_pBrowserCtrl->Navigate(CComBSTR("http://www.romwnet.org/"), &v, &v, &v, &v); + GetModuleFileName(NULL, szExecutable, sizeof(szExecutable)); + + // Construct Windows resource reference + // + m_strDefaultURL += "res://"; + m_strDefaultURL += szExecutable; + m_strDefaultURL += "/default_win.htm"; + + m_pBrowserCtrl->Navigate(m_strDefaultURL, &v, &v, &v, &v); } bHandled = TRUE; diff --git a/samples/gfx_html/browserwnd_win.h b/samples/gfx_html/browserwnd_win.h index cebca3289c..745131d6c3 100644 --- a/samples/gfx_html/browserwnd_win.h +++ b/samples/gfx_html/browserwnd_win.h @@ -52,8 +52,12 @@ public: CComObject* m_pBrowserHost; CComQIPtr m_pBrowserCtrl; + CComBSTR m_strDefaultURL; bool m_bScreensaverMode; + + HICON m_hIcon; + HICON m_hIconSmall; }; #endif \ No newline at end of file diff --git a/samples/gfx_html/res/boinc.ico b/samples/gfx_html/res/boinc.ico new file mode 100644 index 0000000000..c535bce05c Binary files /dev/null and b/samples/gfx_html/res/boinc.ico differ diff --git a/samples/gfx_html/res/boinc.png b/samples/gfx_html/res/boinc.png new file mode 100644 index 0000000000..8c1c142a19 Binary files /dev/null and b/samples/gfx_html/res/boinc.png differ diff --git a/samples/gfx_html/res/default_win.htm b/samples/gfx_html/res/default_win.htm new file mode 100644 index 0000000000..3334b7f031 --- /dev/null +++ b/samples/gfx_html/res/default_win.htm @@ -0,0 +1,73 @@ + + + + + + +
+ + + + + +
+ + +

Loading...

+
+
+ + + + \ No newline at end of file diff --git a/samples/gfx_html/res/virtualbox.png b/samples/gfx_html/res/virtualbox.png new file mode 100644 index 0000000000..59c45a6bdd Binary files /dev/null and b/samples/gfx_html/res/virtualbox.png differ diff --git a/win_build/htmlgfx.vcxproj b/win_build/htmlgfx.vcxproj index 5eece8215b..66661bc668 100644 --- a/win_build/htmlgfx.vcxproj +++ b/win_build/htmlgfx.vcxproj @@ -326,6 +326,11 @@ + + + true + +