|
|
Microsoft OS/2 SDK 2.0 05-30-1990
/*==============================================================*\
* img_help.c - routines for the help manager interface
* Created 1989, 1990 IBM, Microsoft Corp.
*--------------------------------------------------------------
*
* This module contains all the routines for interfacing with
* the IPF help manager.
*
*--------------------------------------------------------------
*
* This source file contains the following functions:
*
* HelpInit()
* HelpHelpForHelp(mp2)
* HelpExtended(mp2)
* HelpIndex(mp2)
* HelpAbout(mp2)
* HelpDestroyInstance()
*
\*==============================================================*/
/*--------------------------------------------------------------*\
* Include files, macros, defined constants, and externs
\*--------------------------------------------------------------*/
#define INCL_WINHELP
#define INCL_WINDIALOGS
#include <os2.h>
#include <string.h>
#include "img_main.h"
#include "img_xtrn.h"
#include "img_dlg.h"
#include "img_help.h"
#define HELPLIBRARYNAMELEN 20
/*--------------------------------------------------------------*\
* Global variables
\*--------------------------------------------------------------*/
static HWND hwndHelpInstance;
#ifdef HELP_MANAGER_ENABLED
/****************************************************************\
* Routine for initializing the help manager
*--------------------------------------------------------------
*
* Name: HelpInit()
*
* Purpose: Initializes the IPF help facility
*
* Usage: Called once during initialization of the program
*
* Method: Initializes the HELPINIT structure and creates the
* help instance. If successful, the help instance
* is associated with the main window
*
* Returns:
*
\****************************************************************/
VOID HelpInit(VOID)
{
HELPINIT hini;
CHAR szLibName[HELPLIBRARYNAMELEN];
CHAR szWindowTitle[HELPLIBRARYNAMELEN];
/* inititalize help init structure */
hini.cb = sizeof(HELPINIT);
hini.ulReturnCode = NULL;
hini.pszTutorialName = (PSZ)NULL; /* if tutorial added, add name here */
hini.phtHelpTable = (PHELPTABLE)(0xFFFF0000 | IMAGE_HELP_TABLE);
hini.hmodHelpTableModule = NULL;
hini.hmodAccelActionBarModule = NULL;
hini.idAccelTable = NULL;
hini.idActionBar = NULL;
#ifdef DEBUG
hini.usShowPanelId = CMIC_SHOW_PANEL_ID;
#else
hini.usShowPanelId = CMIC_HIDE_PANEL_ID;
#endif
if (!WinLoadString(vhab,
NULL,
IDS_HELPWINDOWTITLE,
HELPLIBRARYNAMELEN,
(PSZ)szWindowTitle)) {
MessageBox(vhwndFrame, IDMSG_CANNOTLOADSTRING, 0,
MB_OK | MB_ERROR, FALSE);
return;
}
hini.pszHelpWindowTitle = (PSZ)szWindowTitle;
if (!WinLoadString(vhab,
NULL,
IDS_HELPLIBRARYNAME,
HELPLIBRARYNAMELEN,
(PSZ)szLibName)) {
MessageBox(vhwndFrame, IDMSG_CANNOTLOADSTRING, 0,
MB_OK | MB_ERROR, FALSE);
return;
}
hini.pszHelpLibraryName = (PSZ)szLibName;
/* creating help instance */
hwndHelpInstance = WinCreateHelpInstance(vhab, &hini);
if (!hwndHelpInstance || hini.ulReturnCode) {
MessageBox(vhwndFrame, IDMSG_HELPLOADERROR, 0,
MB_OK | MB_ERROR, FALSE);
return;
}
/* associate help instance with main frame */
if (!WinAssociateHelpInstance(hwndHelpInstance, vhwndFrame)) {
MessageBox(vhwndFrame, IDMSG_HELPLOADERROR, 0,
MB_OK | MB_ERROR, FALSE);
return;
}
/* set flag to enable Help menu items */
vfHelpEnabled = TRUE;
} /* HelpInit() */
/****************************************************************\
* Processes the Help for Help command from the menu bar
*--------------------------------------------------------------
*
* Name: HelpHelpForHelp(mp2)
*
* Purpose: Processes the WM_COMMAND message posted by the
* Help for Help item of the Help menu
*
* Usage: Called from MainCommand when the Help for Help
* menu item is selected
*
* Method: Sends an HM_DISPLAY_HELP message to the help
* instance so that the default Help For Help is
* displayed.
*
* Returns:
*
\****************************************************************/
VOID HelpHelpForHelp(mp2)
MPARAM mp2; /* second parameter of WM_COMMAND message */
{
/* this just displays the system help for help panel */
if (WinSendMsg(hwndHelpInstance, HM_DISPLAY_HELP, NULL, NULL))
MessageBox(vhwndFrame, IDMSG_HELPDISPLAYERROR, 0,
MB_OK | MB_ERROR, FALSE);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter'
\* warning at compile time. */
mp2;
} /* HelpHelpForHelp() */
/****************************************************************\
* Processes the Extended Help command from the menu bar
*--------------------------------------------------------------
*
* Name: HelpExtended(mp2)
*
* Purpose: Processes the WM_COMMAND message posted by the
* Extended Help item of the Help menu
*
* Usage: Called from MainCommand when the Extended Help
* menu item is selected
*
* Method: Sends an HM_EXT_HELP message to the help
* instance so that the default Extended Help is
* displayed.
*
* Returns:
*
\****************************************************************/
VOID HelpExtended(mp2)
MPARAM mp2; /* second parameter of WM_COMMAND message */
{
/* this just displays the system extended help panel */
if (WinSendMsg(hwndHelpInstance, HM_EXT_HELP, NULL, NULL))
MessageBox(vhwndFrame, IDMSG_HELPDISPLAYERROR, 0,
MB_OK | MB_ERROR, FALSE);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter'
\* warning at compile time. */
mp2;
} /* HelpExtended() */
/****************************************************************\
* Processes the Index Help command from the menu bar
*--------------------------------------------------------------
*
* Name: HelpIndex(mp2)
*
* Purpose: Processes the WM_COMMAND message posted by the
* Index Help item of the Help menu
*
* Usage: Called from MainCommand when the Index Help
* menu item is selected
*
* Method: Sends an HM_INDEX_HELP message to the help
* instance so that the default Index Help is
* displayed.
*
* Returns:
*
\****************************************************************/
VOID HelpIndex(mp2)
MPARAM mp2; /* second parameter of WM_COMMAND message */
{
/* this just displays the system help index panel */
if (WinSendMsg(hwndHelpInstance, HM_HELP_INDEX, NULL, NULL))
MessageBox(vhwndFrame, IDMSG_HELPDISPLAYERROR, 0,
MB_OK | MB_ERROR, FALSE);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter'
\* warning at compile time. */
mp2;
} /* HelpIndex() */
/****************************************************************\
* Destroys the help instance
*--------------------------------------------------------------
*
* Name: HelpDestroyInstance(VOID)
*
* Purpose: Destroys the help instance for the application
*
* Usage: Called during Exit List processing
*
* Method: Calls WinDestroyHelpInstance() to destroy the
* help instance
*
* Returns:
*
\****************************************************************/
VOID HelpDestroyInstance(VOID)
{
if(hwndHelpInstance) {
WinDestroyHelpInstance(hwndHelpInstance);
}
vfHelpEnabled = FALSE;
} /* HelpDestroyInstance() */
#endif
/****************************************************************\
* Processes the About command from the Help menu *
*--------------------------------------------------------------*
* *
* Name: HelpAbout() *
* *
* Purpose: Processes the WM_COMMAND message posted by the *
* About item of the Help menu *
* *
* Usage: Called from MainCommand when the About *
* menu item is selected *
* *
* Method: Calls WinDlgBox to display the about box dialog. *
* *
* Returns: *
* *
\****************************************************************/
VOID HelpAbout()
{
WinDlgBox(vhwndClient, vhwndClient, AboutBoxDlgProc, NULL,
IDD_ABOUTBOX, (PVOID)NULL);
/* This routine currently doesn't use the mp2 parameter but *\
* it is referenced here to prevent an 'Unreferenced Parameter' *
\* warning at compile time. */
} /* HelpAbout() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.