Implementing Context Sensitivity in WinHelp and HTML Help

by Paul A. OíRear of Helpful Solutions and Sageline Software

www.sageline.com pao@sageline.com

Example files will be posted at www.sageline.com

The Controversial Part...
(...or the inspiration for this session)

What are we going to cover?

The Way Windows Works

Examples

DONíT JUST SIT THERE - DO SOMETHING!

What every help author should know about how Context Sensitive Help works

Five Common Context Sensitive Help Events

The Five Events and Their Corresponding Messages

So what messages does the developer need to handle?

Implementing Context Sensitive Help from the help author's perspective

WinHelp issues

HTML Help Issues

Include file tips

Food for thought...

Implementing Context Sensitive Help from the Programmer's Perspective

The Help Button

 

WinHelp(hwndBtn, "ourhelp.hlp", HELP_CONTEXT, IDH_THIS_DLG_OVERVIEW);

HtmlHelp(hwndBtn, "ourhelp.chm", HH_HELP_CONTEXT, IDH_THIS_DLG_OVERVIEW);

The F1 Key

1) Create a DWORD array of the control ids and help ids.

 

static DWORD ids[] = {
ID_SAVE, IDH_SAVE,
ID_DELETE, IDH_DELETE,
ID_COPY, IDH_COPY,
ID_PASTE, IDH_PASTE,
0, 0
};

2) Handle the WM_HELP message and call the WinHelp() or HtmlHelp() API functions casting the lParam value passed with the WM_HELP message as a pointer to a HELPINFO structure:

WinHelp(((LPHELPINFO) lParam)->hItemHandle, "ourhelp.hlp", HELP_WM_HELP, (DWORD)(LPVOID) dwArray);

HtmlHelp(((LPHELPINFO) lParam)->hItemHandle, "ourhelp.chm", HH_TP_HELP_WM_HELP, (DWORD)(LPVOID) dwArray);

 

The What's This (?) Button

The Right-Click What's This Context Menu

WinHelp((HWND)wParam, "ourhelp.hlp", HELP_CONTEXTMENU, (DWORD)(LPVOID) dwIDs);

HtmlHelp((HWND)wParam, "ourhelp.chm", HH_TP_HELP_CONTEXTMENU, (DWORD)(LPVOID) dwIDs);

The Shift + F1 What's This Functionality

Q&A

www.helpfulsolutions.com pao@helpfulsolutions.com

www.sageline.com pao@sageline.com