Annotation of os232sdk/toolkt20/c/samples/semaph/sem_help.c, revision 1.1

1.1     ! root        1: /*==============================================================*\
        !             2:  *  sem_help.c - routines for the help manager interface               *
        !             3:  *      Created 1990, Microsoft, IBM Corp.                      *
        !             4:  *--------------------------------------------------------------*
        !             5:  *                                                             *
        !             6:  *  This module contains all the routines for interfacing with *
        !             7:  *  the IPF help manager.                                      *
        !             8:  *                                                             *
        !             9:  *--------------------------------------------------------------*
        !            10:  *                                                             *
        !            11:  *  This source file contains the following functions:         *
        !            12:  *                                                             *
        !            13:  *         InitHelp()                                          *
        !            14:  *         HelpHelpForHelp(mp2)                                *
        !            15:  *         HelpAbout(mp2)                                      *
        !            16:  *                                                             *
        !            17: \*==============================================================*/
        !            18: 
        !            19: /*--------------------------------------------------------------*\
        !            20:  *  Include files, macros, defined constants, and externs      *
        !            21: \*--------------------------------------------------------------*/
        !            22: 
        !            23: #define  LINT_ARGS
        !            24: // #define  DEBUG
        !            25: 
        !            26: #define  INCL_WIN
        !            27: #define  INCL_GPI
        !            28: #define  INCL_DOSPROCESS
        !            29: #define  INCL_WINHELP
        !            30: #include <os2.h>
        !            31: #include <string.h>
        !            32: #include "sem_main.h"
        !            33: #include "sem_dlg.h"
        !            34: #include "sem_help.h"
        !            35: #include "sem_xtrn.h"
        !            36: 
        !            37: #define HELPLIBRARYNAMELEN  20
        !            38: 
        !            39: /*--------------------------------------------------------------*\
        !            40:  *  Global variables                                           *
        !            41: \*--------------------------------------------------------------*/
        !            42: HWND hwndHelpInstance;
        !            43: CHAR szT[HELPLIBRARYNAMELEN];
        !            44: 
        !            45: 
        !            46: /*--------------------------------------------------------------*\
        !            47:  *  Entry point declarations                                   *
        !            48: \*--------------------------------------------------------------*/
        !            49: MRESULT EXPENTRY AboutBoxWndProc(HWND hwnd, USHORT msg,
        !            50:                                  MPARAM mp1, MPARAM mp2);
        !            51: 
        !            52: 
        !            53: /****************************************************************\
        !            54:  *  Routine for initializing the help manager                  *
        !            55:  *--------------------------------------------------------------*
        !            56:  *                                                             *
        !            57:  *  Name:   InitHelp()                                         *
        !            58:  *                                                             *
        !            59:  *  Purpose: Initializes the IPF help facility                 *
        !            60:  *                                                             *
        !            61:  *  Usage:  Called once during initialization of the program   *
        !            62:  *                                                             *
        !            63:  *  Method: Initializes the HELPINIT structure and creates the *
        !            64:  *         help instance.  If successful, the help instance    *
        !            65:  *         is associated with the main window                  *
        !            66:  *                                                             *
        !            67:  *  Returns:                                                   *
        !            68:  *                                                             *
        !            69: \****************************************************************/
        !            70: VOID InitHelp(VOID)
        !            71: {
        !            72: 
        !            73: #ifdef HELP_MANAGER_ENABLED
        !            74:     HELPINIT hini;
        !            75: 
        !            76:     /* inititalize help init structure */
        !            77:     hini.cb = sizeof(HELPINIT);
        !            78:     hini.ulReturnCode = NULL;
        !            79: 
        !            80:     hini.pszTutorialName = (PSZ)NULL;  /* if tutorial added, add name here */
        !            81: 
        !            82:     hini.phtHelpTable = (PHELPTABLE)(0xffff0000 | SAMPLE_HELP_TABLE);
        !            83:     hini.hmodAccelActionBarModule = NULL;
        !            84:     hini.idAccelTable = NULL;
        !            85:     hini.idActionBar = NULL;
        !            86:     hini.pszHelpWindowTitle = (PSZ)"Sample Help";
        !            87: 
        !            88:     /* if debugging, show panel ids, else don't */
        !            89: #ifdef DEBUG
        !            90:     hini.usShowPanelId = CMIC_SHOW_PANEL_ID;
        !            91: #else
        !            92:     hini.usShowPanelId = CMIC_HIDE_PANEL_ID;
        !            93: #endif
        !            94: 
        !            95:     if(!WinLoadString(hab,
        !            96:                      NULL,
        !            97:                      IDS_HELPLIBRARYNAME,
        !            98:                      HELPLIBRARYNAMELEN,
        !            99:                      (PSZ)szT))  {
        !           100:        MessageBox(hwndMain, IDMSG_CANNOTLOADSTRING, FALSE);
        !           101:        return;
        !           102:     }
        !           103: 
        !           104:     hini.pszHelpLibraryName = (PSZ)szT;
        !           105: 
        !           106:     /* creating help instance */
        !           107:     hwndHelpInstance = WinCreateHelpInstance(hab, &hini);
        !           108: 
        !           109:     if(!hwndHelpInstance || hini.ulReturnCode) {
        !           110:        MessageBox(hwndMainFrame, IDMSG_HELPLOADERROR, TRUE);
        !           111:        return;
        !           112:     }
        !           113: 
        !           114:     /* associate help instance with main frame */
        !           115:     WinAssociateHelpInstance(hwndHelpInstance, hwndMainFrame);
        !           116: 
        !           117: #endif
        !           118: 
        !           119: }   /* InitHelp() */
        !           120: 
        !           121: #ifdef HELP_MANAGER_ENABLED
        !           122: 
        !           123: /****************************************************************\
        !           124:  *  Processes the Help for Help command from the menu bar      *
        !           125:  *--------------------------------------------------------------*
        !           126:  *                                                             *
        !           127:  *  Name:   HelHelpForHelp()                                   *
        !           128:  *                                                             *
        !           129:  *  Purpose: Processes the WM_COMMAND message posted by the    *
        !           130:  *           Help for Help item of the Help menu               *
        !           131:  *                                                             *
        !           132:  *  Usage:  Called from MainCommand when the Help for Help     *
        !           133:  *         menu item is selected                               *
        !           134:  *                                                             *
        !           135:  *  Method: Sends an HM_DISPLAY_HELP message to the help       *
        !           136:  *         instance so that the default Help For Help is       *
        !           137:  *         displayed.                                          *
        !           138:  *                                                             *
        !           139:  *  Returns:                                                   *
        !           140:  *                                                             *
        !           141: \****************************************************************/
        !           142: VOID  HelpHelpForHelp(mp2)
        !           143: MPARAM mp2;    /* second parameter of WM_COMMAND message */
        !           144: {
        !           145: 
        !           146:     /* this just displays the system help for help panel */
        !           147:     WinSendMsg(hwndHelpInstance, HM_DISPLAY_HELP, NULL, NULL);
        !           148: 
        !           149:     /* This routine currently doesn't use the mp2 parameter but       *\
        !           150:      * it is referenced here to prevent an 'Unreferenced Parameter'  *
        !           151:     \* warning at compile time.                                      */
        !           152:     mp2;
        !           153: 
        !           154: }   /* HelpHelpForHelp() */
        !           155: 
        !           156: #endif
        !           157: 
        !           158: /****************************************************************\
        !           159:  *  Processes the About command from the Help menu             *
        !           160:  *--------------------------------------------------------------*
        !           161:  *                                                             *
        !           162:  *  Name:   HelpAbout(mp2)                                     *
        !           163:  *                                                             *
        !           164:  *  Purpose: Processes the WM_COMMAND message posted by the    *
        !           165:  *           About item of the Help menu                       *
        !           166:  *                                                             *
        !           167:  *  Usage:  Called from MainCommand when the About             *
        !           168:  *         menu item is selected                               *
        !           169:  *                                                             *
        !           170:  *  Method: Calls WinDlgBox to display the about box dialog.   *
        !           171:  *                                                             *
        !           172:  *  Returns:                                                   *
        !           173:  *                                                             *
        !           174: \****************************************************************/
        !           175: VOID  HelpAbout(mp2)
        !           176: MPARAM mp2;    /* second parameter of WM_COMMAND message */
        !           177: {
        !           178: 
        !           179:     WinDlgBox(hwndMain, hwndMain, AboutBoxWndProc, NULL,
        !           180:                ABOUTBOX, (PVOID)NULL);
        !           181: 
        !           182:     /* This routine currently doesn't use the mp2 parameter but       *\
        !           183:      * it is referenced here to prevent an 'Unreferenced Parameter'  *
        !           184:     \* warning at compile time.                                      */
        !           185:     mp2;
        !           186: 
        !           187: }   /* HelpHelpForHelp() */

unix.superglobalmegacorp.com

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