Commit d1c36342 authored by Erich Hoover's avatar Erich Hoover Committed by Alexandre Julliard

hhctrl.ocx: Recognize the embedded window name for finding existing windows.

parent aedcc11e
......@@ -1825,6 +1825,7 @@ void ReleaseHelpViewer(HHInfo *info)
HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
{
HHInfo *tmp_info;
int i;
if(!info)
......@@ -1853,6 +1854,13 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
}
info->WinType.hwndCaller = caller;
/* If the window is already open then load the file in that existing window */
if ((tmp_info = find_window(info->WinType.pszType)) && tmp_info != info)
{
ReleaseHelpViewer(info);
return CreateHelpViewer(tmp_info, filename, caller);
}
if(!info->viewer_initialized && !CreateViewer(info)) {
ReleaseHelpViewer(info);
return NULL;
......@@ -1949,3 +1957,16 @@ WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_p
heap_free(tmp);
return unicode_text;
}
/* Find the HTMLHelp structure for an existing window title */
HHInfo *find_window(const WCHAR *window)
{
HHInfo *info;
LIST_FOR_EACH_ENTRY(info, &window_list, HHInfo, entry)
{
if (strcmpW(info->WinType.pszType, window) == 0)
return info;
}
return NULL;
}
......@@ -146,18 +146,6 @@ static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD bufle
return (GetFileAttributesW(fullname) != INVALID_FILE_ATTRIBUTES);
}
static inline HHInfo *find_window(const WCHAR *window)
{
HHInfo *info;
LIST_FOR_EACH_ENTRY(info, &window_list, HHInfo, entry)
{
if (strcmpW(info->WinType.pszType, window) == 0)
return info;
}
return NULL;
}
/******************************************************************
* HtmlHelpW (HHCTRL.OCX.15)
*/
......
......@@ -227,7 +227,8 @@ void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN;
LPCWSTR skip_schema(LPCWSTR url) DECLSPEC_HIDDEN;
void wintype_stringsA_free(struct wintype_stringsA *stringsA) DECLSPEC_HIDDEN;
void wintype_stringsW_free(struct wintype_stringsW *stringsW) DECLSPEC_HIDDEN;
WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_page);
WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_page) DECLSPEC_HIDDEN;
HHInfo *find_window(const WCHAR *window) DECLSPEC_HIDDEN;
/* memory allocation functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment