Eric Pouech : winhelp: Now use the icon out of hlpfile if any.

Alexandre Julliard julliard at winehq.org
Wed Apr 23 07:59:32 CDT 2008


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Apr 22 22:00:50 2008 +0200

winhelp: Now use the icon out of hlpfile if any.

---

 programs/winhelp/hlpfile.c |   10 ++++++++++
 programs/winhelp/hlpfile.h |    1 +
 programs/winhelp/winhelp.c |    5 +++++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 815e7f1..92a22df 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1534,6 +1534,15 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
             *m = macro;
             break;
 
+        case 5:
+            if (GET_USHORT(ptr, 4 + 4) != 1)
+                WINE_FIXME("More than one icon, picking up first\n");
+            /* 0x16 is sizeof(CURSORICONDIR), see user32/user_private.h */
+            hlpfile->hIcon = CreateIconFromResourceEx(ptr + 4 + 0x16,
+                                                      GET_USHORT(ptr, 2) - 0x16, TRUE,
+                                                      0x30000, 0, 0, 0);
+            break;
+
         case 6:
             if (GET_USHORT(ptr, 2) != 90) {WINE_WARN("system6\n");break;}
 
@@ -2261,6 +2270,7 @@ void HLPFILE_FreeHlpFile(HLPFILE* hlpfile)
     HLPFILE_DeletePage(hlpfile->first_page);
     HLPFILE_DeleteMacro(hlpfile->first_macro);
 
+    DestroyIcon(hlpfile->hIcon);
     if (hlpfile->numWindows)    HeapFree(GetProcessHeap(), 0, hlpfile->windows);
     HeapFree(GetProcessHeap(), 0, hlpfile->Context);
     HeapFree(GetProcessHeap(), 0, hlpfile->Map);
diff --git a/programs/winhelp/hlpfile.h b/programs/winhelp/hlpfile.h
index 8a27205..739ad38 100644
--- a/programs/winhelp/hlpfile.h
+++ b/programs/winhelp/hlpfile.h
@@ -162,6 +162,7 @@ typedef struct tagHlpFileFile
 
     unsigned                    numWindows;
     HLPFILE_WINDOWINFO*         windows;
+    HICON                       hIcon;
 } HLPFILE;
 
 /*
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 303811f..bb9ea75 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -530,6 +530,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
     WINHELP_WINDOW*     win = NULL;
     BOOL                bPrimary, bPopup, bReUsed = FALSE;
     LPSTR               name;
+    HICON               hIcon;
 
     bPrimary = !lstrcmpi(wpage->wininfo->name, "main");
     bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP);
@@ -633,6 +634,10 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
                      0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, win);
     }
 
+    hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL;
+    if (!hIcon) hIcon = LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP));
+    SendMessage(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon);
+
     /* Initialize file specific pushbuttons */
     if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
     {




More information about the wine-cvs mailing list