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

Alexandre Julliard julliard at winehq.org
Thu Oct 4 13:38:36 CDT 2012


Module: wine
Branch: master
Commit: d1c363424d9ed028d44658bf3ca50a6eca2c7528
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d1c363424d9ed028d44658bf3ca50a6eca2c7528

Author: Erich Hoover <ehoover at mines.edu>
Date:   Wed Oct  3 09:19:53 2012 -0600

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

---

 dlls/hhctrl.ocx/help.c   |   21 +++++++++++++++++++++
 dlls/hhctrl.ocx/hhctrl.c |   12 ------------
 dlls/hhctrl.ocx/hhctrl.h |    3 ++-
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index 833b681..38446dc 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -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;
+}
diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c
index 03592c8..2814ab2 100644
--- a/dlls/hhctrl.ocx/hhctrl.c
+++ b/dlls/hhctrl.ocx/hhctrl.c
@@ -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)
  */
diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h
index 81b6879..e48137d 100644
--- a/dlls/hhctrl.ocx/hhctrl.h
+++ b/dlls/hhctrl.ocx/hhctrl.h
@@ -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 */
 




More information about the wine-cvs mailing list