How to Add a Custom Tab to the Help Topics Dialog BoxLast reviewed: November 20, 1995Article ID: Q139834 |
The information in this article applies to:
SUMMARYThis article discusses how to add a custom tab to the Help Topics dialog box. This option is only available in version 4.0 or later of the Help Compiler for Windows.
MORE INFORMATION
Create a Dialog ResourceTo add a custom tab to the WinHelp Help Topics dialog box, you must do three things:
Write a DLL to Support the Dialog ResourceOnce you have created the dialog resource, you must write a DLL to support it. In addition to including the dialog box procedure, the DLL must export the following function, prototyped as follows:
HWND WINAPI OpenTabDialog(HWND, DWORD, DWORD)This function will be called automatically by WinHelp when the custom tab is clicked; at which point, WinHelp passes the window handle of the tab dialog box as the first parameter. This allows you to call CreateDialog() from within the function. The remaining two parameters are reserved for future use and can be ignored.
Example DLLHere is an example of what this DLL might look like:
#include <windows.h> #include "resource.h"HINSTANCE hinst; // Used by OpenTabDialog()
/* DllMain exists solely for the purpose of obtaining the DLL instance * and storing it in a global variable used to call CreateDialog(). */BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpReserved){
switch (fdwReason){ case DLL_PROCESS_ATTACH: hinst = hinstDll; break; } return (TRUE);} BOOL WINAPI DialogProc (HWND hDlg, UINT message, UINT wParam, long lParam){ . . . return FALSE;}
/* This procedure is called by WINHLP32. Winhelp passes in its hwnd * so you can call Create Dialog. The instance handle for the DLL is * stored in a global variable that is initialized in LibMain.HWND WINAPI OpenTabDialog(HWND hwnd, DWORD dwReserved1, DWORD dwReserved2){
return (CreateDialog (hinst, MAKEINTRESOURCE(IDD_DIALOG1), hwnd, DialogProc));}
Modify the Help Project (.hpj) FileOnce the DLL has been written, you must modify the Help project file (.hpj file) to include the custom tab and link the DLL to it. If you are using HCW, open your Contents file (.cnt file). (If you have not created one, you must do so in order to use your custom tab.) In the Contents dialog box, follow these steps:
:Tab <tab name>=<path to DLL> :Tab mytab=c:\helptab\debug\helptab.dllOnce you make this change, you will need to save the file and recompile your .hpj file.
|
Additional reference words: 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |