From: "Erich E. Hoover" Subject: [PATCH 3/3] hhctrl.ocx: Resize the window when HH_SET_WIN_TYPE is called (try 3, resend 2). Message-Id: Date: Sun, 2 Sep 2012 14:25:06 -0600 This patch adds the final feature to make the embedded help work properly, allowing Elster to resize the HTML Help window whenever the application window is resized. Without this feature the HTML Help window would always remain at the same size as when the window was first created. This time the patch is actually attached. From 19632cb35c6ce28d3482e5ec780badb090c60a4c Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Fri, 31 Aug 2012 15:26:36 -0600 Subject: hhctrl.ocx: Resize the window when HH_SET_WIN_TYPE is called. --- dlls/hhctrl.ocx/chm.c | 6 +++--- dlls/hhctrl.ocx/help.c | 20 ++++++++++++++++++++ dlls/hhctrl.ocx/hhctrl.c | 3 ++- dlls/hhctrl.ocx/hhctrl.h | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c index 4b2f36e..595ded0 100644 --- a/dlls/hhctrl.ocx/chm.c +++ b/dlls/hhctrl.ocx/chm.c @@ -250,7 +250,7 @@ static inline WCHAR *MergeChmString(LPCWSTR src, WCHAR **dst) return *dst; } -void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info) +void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override) { DWORD unhandled_params = src->fsValidMembers & ~(HHWIN_PARAM_PROPERTIES|HHWIN_PARAM_STYLES |HHWIN_PARAM_EXSTYLES|HHWIN_PARAM_RECT|HHWIN_PARAM_NAV_WIDTH @@ -266,7 +266,7 @@ void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info) if (merge & HHWIN_PARAM_PROPERTIES) dst->fsWinProperties = src->fsWinProperties; if (merge & HHWIN_PARAM_STYLES) dst->dwStyles = src->dwStyles; if (merge & HHWIN_PARAM_EXSTYLES) dst->dwExStyles = src->dwExStyles; - if (merge & HHWIN_PARAM_RECT) dst->rcWindowPos = src->rcWindowPos; + if (merge & HHWIN_PARAM_RECT || override) dst->rcWindowPos = src->rcWindowPos; if (merge & HHWIN_PARAM_NAV_WIDTH) dst->iNavWidth = src->iNavWidth; if (merge & HHWIN_PARAM_SHOWSTATE) dst->nShowState = src->nShowState; if (merge & HHWIN_PARAM_INFOTYPES) dst->paInfoTypes = src->paInfoTypes; @@ -379,7 +379,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) } /* merge the new data with any pre-existing HH_WINTYPE structure */ - MergeChmProperties(&wintype, info); + MergeChmProperties(&wintype, info, FALSE); if (!info->WinType.pszFile) info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null); if (!info->WinType.pszToc) diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c index 514b2a8..79e5e11 100644 --- a/dlls/hhctrl.ocx/help.c +++ b/dlls/hhctrl.ocx/help.c @@ -1565,6 +1565,26 @@ static LRESULT Help_OnSize(HWND hWnd) return 0; } +void UpdateHelpWindow(HHInfo *info) +{ + if (!info->WinType.hwndHelp) + return; + + WARN("Only the size of the window is currently updated.\n"); + if (info->WinType.fsValidMembers & HHWIN_PARAM_RECT) + { + RECT *rect = &info->WinType.rcWindowPos; + INT x, y, width, height; + + x = rect->left; + y = rect->top; + width = rect->right - x; + height = rect->bottom - y; + SetWindowPos(info->WinType.hwndHelp, NULL, rect->left, rect->top, width, height, + SWP_NOZORDER | SWP_NOACTIVATE); + } +} + static LRESULT CALLBACK Help_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c index 5618b3f..0ff6dfe 100644 --- a/dlls/hhctrl.ocx/hhctrl.c +++ b/dlls/hhctrl.ocx/hhctrl.c @@ -327,7 +327,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat TRACE("Changing WINTYPE, fsValidMembers=0x%x\n", wintype->fsValidMembers); - MergeChmProperties(wintype, info); + MergeChmProperties(wintype, info, TRUE); + UpdateHelpWindow(info); return 0; } case HH_GET_WIN_TYPE: { diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h index eab7120..7d1ba09 100644 --- a/dlls/hhctrl.ocx/hhctrl.h +++ b/dlls/hhctrl.ocx/hhctrl.h @@ -219,7 +219,8 @@ HHInfo *CreateHelpViewer(HHInfo*,LPCWSTR,HWND) DECLSPEC_HIDDEN; void ReleaseHelpViewer(HHInfo*) DECLSPEC_HIDDEN; BOOL NavigateToUrl(HHInfo*,LPCWSTR) DECLSPEC_HIDDEN; BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN; -void MergeChmProperties(HH_WINTYPEW*,HHInfo*) DECLSPEC_HIDDEN; +void MergeChmProperties(HH_WINTYPEW*,HHInfo*,BOOL) DECLSPEC_HIDDEN; +void UpdateHelpWindow(HHInfo *info) DECLSPEC_HIDDEN; void InitSearch(HHInfo *info, const char *needle) DECLSPEC_HIDDEN; void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN; -- 1.7.5.4