diff --git a/MWebBrowser.cpp b/MWebBrowser.cpp index 31e13ac..8453999 100644 --- a/MWebBrowser.cpp +++ b/MWebBrowser.cpp @@ -4,7 +4,6 @@ #include "MWebBrowser.hpp" #include -#include #include #include @@ -65,6 +64,17 @@ IWebBrowser2 *MWebBrowser::GetIWebBrowser2() return m_web_browser2; } +IHTMLDocument2 *MWebBrowser::GetIHTMLDocument2() +{ + IDispatch *pDisp; + m_web_browser2->get_Document(&pDisp); + if (pDisp) + { + return static_cast(pDisp); + } + return NULL; +} + HWND MWebBrowser::GetControlWindow() { if (::IsWindow(m_hwndCtrl)) diff --git a/MWebBrowser.hpp b/MWebBrowser.hpp index 435216b..438c249 100644 --- a/MWebBrowser.hpp +++ b/MWebBrowser.hpp @@ -7,6 +7,7 @@ #include #include +#include class MWebBrowser : public IOleClientSite, @@ -38,6 +39,7 @@ class MWebBrowser : void Destroy(); BOOL TranslateAccelerator(LPMSG pMsg); IWebBrowser2 *GetIWebBrowser2(); + IHTMLDocument2 *GetIHTMLDocument2(); void AllowInsecure(BOOL bAllow); HRESULT get_Application(IDispatch **ppApplication) const; diff --git a/RightSide_en.txt b/RightSide_en.txt index 131ab49..53ebbd3 100644 --- a/RightSide_en.txt +++ b/RightSide_en.txt @@ -5,6 +5,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Home 60 #104 +Move Up 60 #132 +Move Down 60 #133 Stop/Reload 60 #103 Print Preview 60 #113 Print... 60 #111 diff --git a/RightSide_ja.txt b/RightSide_ja.txt index b0049ca..31e8c19 100644 --- a/RightSide_ja.txt +++ b/RightSide_ja.txt @@ -5,6 +5,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; <ボタンのテキスト> <ボタンの高さ> <コマンドIDまたはURLまたはコマンドライン> ホーム 60 #104 +↑上へ移動 60 #132 +↓下へ移動 60 #133 停止/再読み込み 60 #103 印刷プレビュー 60 #113 印刷... 60 #111 diff --git a/SimpleBrowser.cpp b/SimpleBrowser.cpp index b6b5951..cc01df0 100644 --- a/SimpleBrowser.cpp +++ b/SimpleBrowser.cpp @@ -1875,6 +1875,42 @@ void OnCancelPrinting(HWND hwnd) DoExecute(hwnd, L"CancelPrinting.bat", SW_HIDE); } +void OnUp(HWND hwnd) +{ + if (IHTMLDocument2 *pDocument = s_pWebBrowser->GetIHTMLDocument2()) + { + IHTMLWindow2 *pWindow = NULL; + pDocument->get_parentWindow(&pWindow); + if (pWindow) + { + for (int i = 0; i < 10; ++i) + { + pWindow->scrollBy(0, -40); + } + pWindow->Release(); + } + pDocument->Release(); + } +} + +void OnDown(HWND hwnd) +{ + if (IHTMLDocument2 *pDocument = s_pWebBrowser->GetIHTMLDocument2()) + { + IHTMLWindow2 *pWindow = NULL; + pDocument->get_parentWindow(&pWindow); + if (pWindow) + { + for (int i = 0; i < 10; ++i) + { + pWindow->scrollBy(0, 40); + } + pWindow->Release(); + } + pDocument->Release(); + } +} + void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { static INT s_nLevel = 0; @@ -1979,6 +2015,12 @@ void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) case ID_CANCEL_PRINTING: OnCancelPrinting(hwnd); break; + case ID_UP: + OnUp(hwnd); + break; + case ID_DOWN: + OnDown(hwnd); + break; } --s_nLevel; diff --git a/resource.h b/resource.h index 057568b..59bb846 100644 --- a/resource.h +++ b/resource.h @@ -77,12 +77,14 @@ #define ID_GO_URL 129 #define ID_EXECUTE_CMD 130 #define ID_CANCEL_PRINTING 131 +#define ID_UP 132 +#define ID_DOWN 133 #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 101 - #define _APS_NEXT_COMMAND_VALUE 129 + #define _APS_NEXT_COMMAND_VALUE 134 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 300 #endif