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

This commit is contained in:
Erich Hoover 2012-10-03 09:19:53 -06:00 committed by Alexandre Julliard
parent aedcc11e4f
commit d1c363424d
3 changed files with 23 additions and 13 deletions

View File

@ -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;
}

View File

@ -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)
*/

View File

@ -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 */