[PATCH 42/45] [WinHelp]: added support for embedded icon (if any)
Eric Pouech
eric.pouech at orange.fr
Sun Mar 23 04:21:46 CDT 2008
A+
---
programs/winhelp/hlpfile.c | 10 ++++++++++
programs/winhelp/hlpfile.h | 1 +
programs/winhelp/winhelp.c | 6 ++++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 19c8f0b..a723640 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1878,6 +1878,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;}
@@ -2557,6 +2566,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 5b02085..668ca28 100644
--- a/programs/winhelp/hlpfile.h
+++ b/programs/winhelp/hlpfile.h
@@ -123,6 +123,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 bfc8065..6918ecf 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -672,6 +672,12 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
}
else
{
+ DWORD_PTR icon;
+
+ icon = (wpage->page) ? (DWORD_PTR)wpage->page->file->hIcon : 0;
+ if (!icon) icon = (DWORD_PTR)LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP));
+
+ SetClassLongPtrW(win->hMainWnd, GCL_HICON, icon);
WINHELP_LayoutMainWindow(win);
WINHELP_FillRichEdit(GetDlgItem(win->hMainWnd, CTL_ID_TEXT), win);
ShowWindow(win->hMainWnd, nCmdShow);
More information about the wine-patches
mailing list