(1) fixes needing to run the the script with the current working directory
the same as the location of the chm file - in this example the perl script
needs to be in the same directory as the chm file.
(2) Adds context help: click the '?' icon in the title bar, then one of the
buttons, or tab to one of the buttons (to give it focus) and hit 'F1'
Nice example:) Do you think it's worth adding the ShowHelpContext function
to the core of Win32-GUI so that there is no dependency on Win32::OLE? The
code is relatively straightforward:
http://search.cpan.org/src/JDB/libwin32-0.24/OLE/OLE.xs
void
_ShowHelpContext(helpfile,context)
char *helpfile
IV context
PPCODE:
{
HWND hwnd;
dPERINTERP;
if (!g_hHHCTRL) {
g_hHHCTRL = LoadLibrary("HHCTRL.OCX");
if (g_hHHCTRL)
g_pfnHtmlHelp = (FNHTMLHELP*)GetProcAddress(g_hHHCTRL, "HtmlHelpA");
}
if (!g_pfnHtmlHelp) {
warn(MY_VERSION ": HtmlHelp control unavailable");
XSRETURN_EMPTY;
}
// HH_HELP_CONTEXT 0x0F: display mapped numeric value in dwData
hwnd = g_pfnHtmlHelp(GetDesktopWindow(), helpfile, 0x0f,
(DWORD)context);
if (hwnd == 0 && context == 0) // try HH_DISPLAY_TOPIC 0x0
g_pfnHtmlHelp(GetDesktopWindow(), helpfile, 0, (DWORD)context);
}
Cheers,
jez.