[PATCH 1/4] [WinHelp]: start implementing a prop sheet for all lookup needs

Eric Pouech eric.pouech at orange.fr
Fri Jun 27 14:28:44 CDT 2008




A+
---

 programs/winhlp32/Bg.rc         |    1 
 programs/winhlp32/Cs.rc         |    1 
 programs/winhlp32/Da.rc         |    1 
 programs/winhlp32/De.rc         |    1 
 programs/winhlp32/En.rc         |    1 
 programs/winhlp32/Eo.rc         |    1 
 programs/winhlp32/Es.rc         |    1 
 programs/winhlp32/Fi.rc         |    1 
 programs/winhlp32/Fr.rc         |    1 
 programs/winhlp32/Hu.rc         |    1 
 programs/winhlp32/It.rc         |    1 
 programs/winhlp32/Ko.rc         |    1 
 programs/winhlp32/Makefile.in   |    3 +
 programs/winhlp32/Nl.rc         |    1 
 programs/winhlp32/No.rc         |    1 
 programs/winhlp32/Pl.rc         |    1 
 programs/winhlp32/Pt.rc         |    2 +
 programs/winhlp32/Rm.rc         |    1 
 programs/winhlp32/Ru.rc         |    1 
 programs/winhlp32/Si.rc         |    1 
 programs/winhlp32/Sk.rc         |    1 
 programs/winhlp32/Sv.rc         |    1 
 programs/winhlp32/Tr.rc         |    1 
 programs/winhlp32/Wa.rc         |    1 
 programs/winhlp32/Zh.rc         |    1 
 programs/winhlp32/winhelp.c     |   94 +++++++++++++++++++++++++++------------
 programs/winhlp32/winhelp_res.h |    1 
 27 files changed, 94 insertions(+), 29 deletions(-)


diff --git a/programs/winhlp32/Bg.rc b/programs/winhlp32/Bg.rc
index 920aec7..4cb04e5 100644
--- a/programs/winhlp32/Bg.rc
+++ b/programs/winhlp32/Bg.rc
@@ -82,4 +82,5 @@ STID_ALL_FILES, 	"Âñè÷êè ôàéëîâå (*.*)"
 STID_HELP_FILES_HLP, 	"Ïîìîùíè ôàéëîâå (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Cs.rc b/programs/winhlp32/Cs.rc
index d457e3c..98d2d81 100644
--- a/programs/winhlp32/Cs.rc
+++ b/programs/winhlp32/Cs.rc
@@ -87,4 +87,5 @@ STID_ALL_FILES, 	"Všechny soubory (*.*)"
 STID_HELP_FILES_HLP, 	"Soubory nápovìdy (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Da.rc b/programs/winhlp32/Da.rc
index 3671d8b..9e5c489 100644
--- a/programs/winhlp32/Da.rc
+++ b/programs/winhlp32/Da.rc
@@ -94,4 +94,5 @@ STID_ALL_FILES, 	"Alle filer (*.*)"
 STID_HELP_FILES_HLP, 	"Hjælpe filer (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Kan ikke finde '%s'. Vil du selv finde filen?"
 STID_NO_RICHEDIT	"Kan ikke finde en 'richedit' implementering... Afbryder"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/De.rc b/programs/winhlp32/De.rc
index 11ca356..4686275 100644
--- a/programs/winhlp32/De.rc
+++ b/programs/winhlp32/De.rc
@@ -94,6 +94,7 @@ STID_ALL_FILES, 	"Alle Dateien (*.*)"
 STID_HELP_FILES_HLP, 	"Hilfe-Dateien (*.hlp)"
 STID_FILE_NOT_FOUND_s	"'%s' konnte nicht gefunden werden. Wollen Sie selber nach dieser Datei suchen?"
 STID_NO_RICHEDIT	"Die Richedit Implementation konnte nicht gefunden werden... Breche ab."
+STID_PSH_INDEX,		"Help topics: "
 }
 
 CONTEXT_MENU MENU LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
diff --git a/programs/winhlp32/En.rc b/programs/winhlp32/En.rc
index 0eb9269..4407d78 100644
--- a/programs/winhlp32/En.rc
+++ b/programs/winhlp32/En.rc
@@ -93,6 +93,7 @@ STID_ALL_FILES, 	"All files (*.*)"
 STID_HELP_FILES_HLP, 	"Help files (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 CONTEXT_MENU MENU LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
diff --git a/programs/winhlp32/Eo.rc b/programs/winhlp32/Eo.rc
index a62634e..f3f0ecb 100644
--- a/programs/winhlp32/Eo.rc
+++ b/programs/winhlp32/Eo.rc
@@ -85,4 +85,5 @@ STID_ALL_FILES, 	"Tutaj dosieroj (*.*)"
 STID_HELP_FILES_HLP, 	"Helpaj dosieroj (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Es.rc b/programs/winhlp32/Es.rc
index 06120a4..d514b7a 100644
--- a/programs/winhlp32/Es.rc
+++ b/programs/winhlp32/Es.rc
@@ -84,4 +84,5 @@ STID_ALL_FILES, 	"Todos los archivos (*.*)"
 STID_HELP_FILES_HLP, 	"Archivos de ayuda (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Fi.rc b/programs/winhlp32/Fi.rc
index 860e5db..588c253 100644
--- a/programs/winhlp32/Fi.rc
+++ b/programs/winhlp32/Fi.rc
@@ -85,4 +85,5 @@ STID_ALL_FILES, 	"Kaikki tiedostot (*.*)"
 STID_HELP_FILES_HLP, 	"Ohjetiedostot (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Fr.rc b/programs/winhlp32/Fr.rc
index a706d88..1a976ad 100644
--- a/programs/winhlp32/Fr.rc
+++ b/programs/winhlp32/Fr.rc
@@ -96,6 +96,7 @@ STID_ALL_FILES, 	"Tous fichiers (*.*)"
 STID_HELP_FILES_HLP, 	"Fichiers d'aide (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Impossible de trouver « %s ». Souhaitez-vous rechercher ce fichier vous-même ?"
 STID_NO_RICHEDIT	"La bibliothèque RichEdit n'a pu être localisée... Abandon"
+STID_PSH_INDEX,		"Rubriques d'aide : "
 }
 
 CONTEXT_MENU MENU
diff --git a/programs/winhlp32/Hu.rc b/programs/winhlp32/Hu.rc
index eddafe3..3c08f06 100644
--- a/programs/winhlp32/Hu.rc
+++ b/programs/winhlp32/Hu.rc
@@ -85,4 +85,5 @@ STID_ALL_FILES, 	"Minden fájl (*.*)"
 STID_HELP_FILES_HLP, 	"Súgó fájlok (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/It.rc b/programs/winhlp32/It.rc
index a294fcc..bfeccf1 100644
--- a/programs/winhlp32/It.rc
+++ b/programs/winhlp32/It.rc
@@ -84,4 +84,5 @@ STID_ALL_FILES, 	"Tutti i file (*.*)"
 STID_HELP_FILES_HLP, 	"File della Guida (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Ko.rc b/programs/winhlp32/Ko.rc
index 32289db..290bfc2 100644
--- a/programs/winhlp32/Ko.rc
+++ b/programs/winhlp32/Ko.rc
@@ -96,6 +96,7 @@ STID_ALL_FILES, 	"¸ðµç ÆÄÀÏ (*.*)"
 STID_HELP_FILES_HLP, 	"µµ¿ò¸» ÆÄÀÏ (*.hlp)"
 STID_FILE_NOT_FOUND_s	"%sÀ» ãÀ» ¼ö ¾ø½À´Ï´Ù'. ÀÌ ÆÄÀÏÀ» Á÷Á¢ ã°Ú½À´Ï±î?"
 STID_NO_RICHEDIT	"richedit  ±¸ÇöÀ» ãÀ»¼ö ¾÷½À´Ï´Ù.. Ãë¼ÒÁß"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 CONTEXT_MENU MENU LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL
diff --git a/programs/winhlp32/Makefile.in b/programs/winhlp32/Makefile.in
index 5deecf0..4796564 100644
--- a/programs/winhlp32/Makefile.in
+++ b/programs/winhlp32/Makefile.in
@@ -4,7 +4,8 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winhlp32.exe
 APPMODE   = -mwindows
-IMPORTS   = comdlg32 shell32 user32 gdi32 kernel32
+IMPORTS   = user32 gdi32 kernel32
+DELAYIMPORTS = shell32 comctl32 comdlg32
 
 C_SRCS = \
 	callback.c \
diff --git a/programs/winhlp32/Nl.rc b/programs/winhlp32/Nl.rc
index b3fc34c..d5b7268 100644
--- a/programs/winhlp32/Nl.rc
+++ b/programs/winhlp32/Nl.rc
@@ -93,6 +93,7 @@ STID_ALL_FILES, 	"Alle bestanden (*.*)"
 STID_HELP_FILES_HLP, 	"Helpbestanden (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Kan '%s' niet openen. Wilt u zelf dit bestand zoeken?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 CONTEXT_MENU MENU LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
diff --git a/programs/winhlp32/No.rc b/programs/winhlp32/No.rc
index 2e76649..54e65c8 100644
--- a/programs/winhlp32/No.rc
+++ b/programs/winhlp32/No.rc
@@ -92,4 +92,5 @@ STID_ALL_FILES, 	"Alle filer (*.*)"
 STID_HELP_FILES_HLP, 	"Hjelp-filer (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Pl.rc b/programs/winhlp32/Pl.rc
index bea1693..ca80974 100644
--- a/programs/winhlp32/Pl.rc
+++ b/programs/winhlp32/Pl.rc
@@ -94,6 +94,7 @@ STID_ALL_FILES, 	"Wszystkie pliki (*.*)"
 STID_HELP_FILES_HLP, 	"Pliki pomocy (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Nie znaleziono pliku '%s'. Czy chcesz poszukaæ tego pliku samodzielnie?"
 STID_NO_RICHEDIT	"Nie uda³o siê znaleŸæ modu³u richedit... Wyœwietlenie pomocy nie jest mo¿liwe"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 
diff --git a/programs/winhlp32/Pt.rc b/programs/winhlp32/Pt.rc
index 6c6cdbb..939d844 100644
--- a/programs/winhlp32/Pt.rc
+++ b/programs/winhlp32/Pt.rc
@@ -139,6 +139,7 @@ STID_ALL_FILES, 	"Todos os arquivos (*.*)"
 STID_HELP_FILES_HLP, 	"Arquivos de ajuda (*.hlp)"
 STID_FILE_NOT_FOUND_s   "Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE
@@ -159,4 +160,5 @@ STID_ALL_FILES, 	"Todos os ficheiros (*.*)"
 STID_HELP_FILES_HLP, 	"Ficheiros de ajuda (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Não é possível encontrar '%s'. Deseja procurar este ficheiro você mesmo?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Rm.rc b/programs/winhlp32/Rm.rc
index cbcd16c..df90d77 100644
--- a/programs/winhlp32/Rm.rc
+++ b/programs/winhlp32/Rm.rc
@@ -87,4 +87,5 @@ STID_ALL_FILES,         "Tuot las datotecas (*.*)"
 STID_HELP_FILES_HLP,    "Datotecas d'ag�d (*.hlp)"
 STID_FILE_NOT_FOUND_s   "Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Ru.rc b/programs/winhlp32/Ru.rc
index 0d32728..55dd1f8 100644
--- a/programs/winhlp32/Ru.rc
+++ b/programs/winhlp32/Ru.rc
@@ -92,6 +92,7 @@ STID_ALL_FILES, 	"Âñå ôàéëû (*.*)"
 STID_HELP_FILES_HLP, 	"Ôàéëû ñïðàâêè (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Íå ìîãó íàéòè '%s'. Âû õîòèòå íàéòè ýòîò ôàéë ñàìîñòîÿòåëüíî?"
 STID_NO_RICHEDIT	"Íå ìîãó íàéòè richedit"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 CONTEXT_MENU MENU LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
diff --git a/programs/winhlp32/Si.rc b/programs/winhlp32/Si.rc
index da9448b..8d4a0f4 100644
--- a/programs/winhlp32/Si.rc
+++ b/programs/winhlp32/Si.rc
@@ -94,6 +94,7 @@ STID_ALL_FILES, 	"Vse datoteke (*.*)"
 STID_HELP_FILES_HLP, 	"Datoteke s pomočjo (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Ne najdem datoteke '%s'. Ali jo želite poiskati sami?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 #pragma code_page(default)
diff --git a/programs/winhlp32/Sk.rc b/programs/winhlp32/Sk.rc
index eeb766e..e849e92 100644
--- a/programs/winhlp32/Sk.rc
+++ b/programs/winhlp32/Sk.rc
@@ -80,4 +80,5 @@ STID_ALL_FILES,             "Všetky súbory (*.*)"
 STID_HELP_FILES_HLP,        "Súbory pomoci (*.hlp)"
 STID_FILE_NOT_FOUND_s       "Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	    "Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Sv.rc b/programs/winhlp32/Sv.rc
index 2991ad0..bd479c4 100644
--- a/programs/winhlp32/Sv.rc
+++ b/programs/winhlp32/Sv.rc
@@ -85,4 +85,5 @@ STID_ALL_FILES, 	"Alla filer (*.*)"
 STID_HELP_FILES_HLP, 	"Hjälpfiler (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Kan inte hitta '%s'. Vill du söka efter denna fil?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Tr.rc b/programs/winhlp32/Tr.rc
index ce5501f..205129e 100644
--- a/programs/winhlp32/Tr.rc
+++ b/programs/winhlp32/Tr.rc
@@ -82,4 +82,5 @@ STID_ALL_FILES, 	"Tüm dosyalar (*.*)"
 STID_HELP_FILES_HLP, 	"Yardým dosyalarý (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/Wa.rc b/programs/winhlp32/Wa.rc
index 1a47bc7..49c66fb 100644
--- a/programs/winhlp32/Wa.rc
+++ b/programs/winhlp32/Wa.rc
@@ -87,6 +87,7 @@ STID_ALL_FILES, 	"Tos les fitchîs (*.*)"
 STID_HELP_FILES_HLP, 	"Fitchîs d' aide (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
 
 #endif  /* LANG_WALON */
diff --git a/programs/winhlp32/Zh.rc b/programs/winhlp32/Zh.rc
index ed9c8b4..c7dd7d6 100644
--- a/programs/winhlp32/Zh.rc
+++ b/programs/winhlp32/Zh.rc
@@ -83,4 +83,5 @@ STID_ALL_FILES, 	"ËùÓÐÎļþ (*.*)"
 STID_HELP_FILES_HLP, 	"°ïÖúÎļþ (*.hlp)"
 STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
 STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
+STID_PSH_INDEX,		"Help topics: "
 }
diff --git a/programs/winhlp32/winhelp.c b/programs/winhlp32/winhelp.c
index 962a3a0..8307f61 100644
--- a/programs/winhlp32/winhelp.c
+++ b/programs/winhlp32/winhelp.c
@@ -27,6 +27,9 @@
 #include <stdarg.h>
 #include <stdlib.h>
 
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
@@ -36,6 +39,7 @@
 #include "winhelp_res.h"
 #include "shellapi.h"
 #include "richedit.h"
+#include "commctrl.h"
 
 #include "wine/debug.h"
 
@@ -1536,6 +1540,13 @@ static void cb_KWBTree(void *p, void **next, void *cookie)
     *next = (char*)p + strlen((char*)p) + 7;
 }
 
+struct index_data
+{
+    HLPFILE*    hlpfile;
+    BOOL        jump;
+    ULONG       offset;
+};
+
 /**************************************************************************
  * WINHELP_IndexDlgProc
  *
@@ -1546,23 +1557,24 @@ static void cb_KWBTree(void *p, void **next, void *cookie)
  *  >1: valid offset value +2.
  *  EndDialog itself can return 0 (error).
  */
-INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    static HLPFILE *file;
+    static struct index_data* id;
     int sel;
-    ULONG offset = 1;
 
     switch (msg)
     {
     case WM_INITDIALOG:
-        file = (HLPFILE *)lParam;
-        HLPFILE_BPTreeEnum(file->kwbtree, cb_KWBTree,
+        id = (struct index_data*)((PROPSHEETPAGE*)lParam)->lParam;
+        HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree,
                            GetDlgItem(hWnd, IDC_INDEXLIST));
+        id->jump = FALSE;
+        id->offset = 1;
         return TRUE;
-    case WM_COMMAND:
-        switch (LOWORD(wParam))
-        {
-        case IDOK:
+    case WM_NOTIFY:
+	switch (((NMHDR*)lParam)->code)
+	{
+	case PSN_APPLY:
             sel = SendDlgItemMessage(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0);
             if (sel != LB_ERR)
             {
@@ -1575,24 +1587,25 @@ INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
                 if (count > 1)
                 {
                     MessageBox(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP);
+                    SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID);
                     return TRUE;
                 }
-                offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
-                offset = *(long*)(file->kwdata + offset + 9);
-                if (offset == 0xFFFFFFFF)
+                id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
+                id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9);
+                if (id->offset == 0xFFFFFFFF)
                 {
                     MessageBox(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
+                    SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID);
                     return TRUE;
                 }
-                offset += 2;
+                id->jump = TRUE;
+                SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR);
             }
-            /* Fall through */
-        case IDCANCEL:
-            EndDialog(hWnd, offset);
             return TRUE;
         default:
-            break;
+            return FALSE;
         }
+        break;
     default:
         break;
     }
@@ -1607,28 +1620,53 @@ INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
  */
 BOOL WINHELP_CreateIndexWindow(void)
 {
-    int ret;
-    HLPFILE *hlpfile;
+    HPROPSHEETPAGE      psPage[3];
+    PROPSHEETPAGE       psp;
+    PROPSHEETHEADER     psHead;
+    struct index_data   id;
+    char                buf[256];
 
     if (Globals.active_win && Globals.active_win->page && Globals.active_win->page->file)
-        hlpfile = Globals.active_win->page->file;
+        id.hlpfile = Globals.active_win->page->file;
     else
         return FALSE;
 
-    if (hlpfile->kwbtree == NULL)
+    if (id.hlpfile->kwbtree == NULL)
     {
         WINE_TRACE("No index provided\n");
         return FALSE;
     }
 
-    ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_INDEX),
-                         Globals.active_win->hMainWnd, WINHELP_SearchDlgProc,
-                         (LPARAM)hlpfile);
-    if (ret > 1)
+    InitCommonControls();
+
+    id.jump = FALSE;
+    memset(&psp, 0, sizeof(psp));
+    psp.dwSize = sizeof(psp);
+    psp.dwFlags = 0;
+    psp.hInstance = Globals.hInstance;
+
+    psp.u.pszTemplate = MAKEINTRESOURCE(IDD_INDEX);
+    psp.lParam = (LPARAM)&id;
+    psp.pfnDlgProc = WINHELP_IndexDlgProc;
+    psPage[0] = CreatePropertySheetPage(&psp);
+
+    memset(&psHead, 0, sizeof(psHead));
+    psHead.dwSize = sizeof(psHead);
+
+    LoadString(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf));
+    strcat(buf, Globals.active_win->info->caption);
+
+    psHead.pszCaption = buf;
+    psHead.nPages = 1;
+    psHead.hwndParent = Globals.active_win->hMainWnd;
+    psHead.u3.phpage = psPage;
+    psHead.dwFlags = PSH_NOAPPLYNOW;
+
+    PropertySheet(&psHead);
+    if (id.jump)
     {
-        ret -= 2;
-        WINE_TRACE("got %d as an offset\n", ret);
-        WINHELP_OpenHelpWindow(HLPFILE_PageByOffset, hlpfile, ret,
+        WINE_TRACE("got %d as an offset\n", id.offset);
+        WINHELP_OpenHelpWindow(HLPFILE_PageByOffset, id.hlpfile, id.offset,
                                Globals.active_win->info, SW_NORMAL);
     }
     return TRUE;
diff --git a/programs/winhlp32/winhelp_res.h b/programs/winhlp32/winhelp_res.h
index 3aa25a8..eb57a96 100644
--- a/programs/winhlp32/winhelp_res.h
+++ b/programs/winhlp32/winhelp_res.h
@@ -51,6 +51,7 @@
 #define STID_DIALOG_TEST	0x12D
 #define STID_FILE_NOT_FOUND_s	0x12E
 #define STID_NO_RICHEDIT        0x12F
+#define STID_PSH_INDEX          0x130
 
 #define IDD_INDEX               0x150
 #define IDC_INDEXLIST           0x151





More information about the wine-patches mailing list