File:  [OS/2 SDKs] / os232sdk / toolkt20 / c / samples / semaph / sem_help.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:30 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1990, HEAD
Microsoft OS/2 SDK 2.0 05-30-1990

/*==============================================================*\
 *  sem_help.c - routines for the help manager interface		*
 *      Created 1990, Microsoft, IBM Corp.                      *
 *--------------------------------------------------------------*
 *								*
 *  This module contains all the routines for interfacing with	*
 *  the IPF help manager.					*
 *								*
 *--------------------------------------------------------------*
 *								*
 *  This source file contains the following functions:		*
 *								*
 *	    InitHelp()						*
 *	    HelpHelpForHelp(mp2)				*
 *	    HelpAbout(mp2)					*
 *								*
\*==============================================================*/

/*--------------------------------------------------------------*\
 *  Include files, macros, defined constants, and externs	*
\*--------------------------------------------------------------*/

#define  LINT_ARGS
// #define  DEBUG

#define  INCL_WIN
#define  INCL_GPI
#define  INCL_DOSPROCESS
#define  INCL_WINHELP
#include <os2.h>
#include <string.h>
#include "sem_main.h"
#include "sem_dlg.h"
#include "sem_help.h"
#include "sem_xtrn.h"

#define HELPLIBRARYNAMELEN  20

/*--------------------------------------------------------------*\
 *  Global variables						*
\*--------------------------------------------------------------*/
HWND hwndHelpInstance;
CHAR szT[HELPLIBRARYNAMELEN];


/*--------------------------------------------------------------*\
 *  Entry point declarations					*
\*--------------------------------------------------------------*/
MRESULT EXPENTRY AboutBoxWndProc(HWND hwnd, USHORT msg,
				  MPARAM mp1, MPARAM mp2);


/****************************************************************\
 *  Routine for initializing the help manager			*
 *--------------------------------------------------------------*
 *								*
 *  Name:   InitHelp()						*
 *								*
 *  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 InitHelp(VOID)
{

#ifdef HELP_MANAGER_ENABLED
    HELPINIT hini;

    /* 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 | SAMPLE_HELP_TABLE);
    hini.hmodAccelActionBarModule = NULL;
    hini.idAccelTable = NULL;
    hini.idActionBar = NULL;
    hini.pszHelpWindowTitle = (PSZ)"Sample Help";

    /* if debugging, show panel ids, else don't */
#ifdef DEBUG
    hini.usShowPanelId = CMIC_SHOW_PANEL_ID;
#else
    hini.usShowPanelId = CMIC_HIDE_PANEL_ID;
#endif

    if(!WinLoadString(hab,
		      NULL,
		      IDS_HELPLIBRARYNAME,
		      HELPLIBRARYNAMELEN,
		      (PSZ)szT))  {
	MessageBox(hwndMain, IDMSG_CANNOTLOADSTRING, FALSE);
	return;
    }

    hini.pszHelpLibraryName = (PSZ)szT;

    /* creating help instance */
    hwndHelpInstance = WinCreateHelpInstance(hab, &hini);

    if(!hwndHelpInstance || hini.ulReturnCode)	{
	MessageBox(hwndMainFrame, IDMSG_HELPLOADERROR, TRUE);
	return;
    }

    /* associate help instance with main frame */
    WinAssociateHelpInstance(hwndHelpInstance, hwndMainFrame);

#endif

}   /* InitHelp() */

#ifdef HELP_MANAGER_ENABLED

/****************************************************************\
 *  Processes the Help for Help command from the menu bar	*
 *--------------------------------------------------------------*
 *								*
 *  Name:   HelHelpForHelp()					*
 *								*
 *  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 */
    WinSendMsg(hwndHelpInstance, HM_DISPLAY_HELP, NULL, NULL);

    /* 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() */

#endif

/****************************************************************\
 *  Processes the About command from the Help menu		*
 *--------------------------------------------------------------*
 *								*
 *  Name:   HelpAbout(mp2)					*
 *								*
 *  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(mp2)
MPARAM mp2;	/* second parameter of WM_COMMAND message */
{

    WinDlgBox(hwndMain, hwndMain, AboutBoxWndProc, NULL,
		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.				      */
    mp2;

}   /* HelpHelpForHelp() */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.