home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / pm / ipf / ipf.c < prev    next >
C/C++ Source or Header  |  1999-05-11  |  33KB  |  657 lines

  1. /*static char *SCCSID = "@(#)ipf.c    6.2 91/12/24";*/
  2.  
  3. /***************** IPF C Sample Program Source Code File (.C) ****************\
  4.  *                                                                           *
  5.  * PROGRAM NAME: IPF.C   PM Sample Application                               *
  6.  * ─────────────                                                             *
  7.  *                                                                           *
  8.  *   (C) Copyright International Business Machines Corporation 1991          *
  9.  *                                                                           *
  10.  * REVISION HISTORY:                                                         *
  11.  * ─────────────────                                                         *
  12.  *                                                                           *
  13.  *   Revision level - 2.0                                                    *
  14.  *                                                                           *
  15.  * WHAT THIS PROGRAM DOES:                                                   *
  16.  * ───────────────────────                                                   *
  17.  *                                                                           *
  18.  *   This program creates an IPF Application Controlled Window.              *
  19.  *                                                                           *
  20.  * WHAT THIS PROGRAM DEMONSTRATES:                                           *
  21.  * ───────────────────────────────                                           *
  22.  *                                                                           *
  23.  *   This program illustrates a suggested format for sample Help Manager     *
  24.  *   code using the Information Presentation Facility.                       *
  25.  *                                                                           *
  26.  * API CALLS FEATURED:                                                       *
  27.  * ───────────────────                                                       *
  28.  *                                                                           *
  29.  *      DosFreeModule               WinMessageBox                            *
  30.  *      DosLoadModule               WinRegisterClass                         *
  31.  *      GpiDeleteBitmap             WinReleasePS                             *
  32.  *      GpiLoadBitmap               WinSendMsg                               *
  33.  *      WinBeginPaint               WinSetWindowULong                        *
  34.  *      WinDefWindowProc            WinStartTimer                            *
  35.  *      WinDestroyWindow            WinStopTimer                             *
  36.  *      WinDrawBitMap               WinQueryAnchorBlock                      *
  37.  *      WinEndPaint                 WinQueryWindow                           *
  38.  *      WinGetPS                    WinQueryWindowULong                      *
  39.  *      WinInvalidateRect                                                    *
  40.  *                                                                           *
  41.  *                                                                           *
  42.  * WHAT YOU NEED TO COMPILE AND LINK THIS PROGRAM:                           *
  43.  * ───────────────────────────────────────────────                           *
  44.  *                                                                           *
  45.  *      REQUIRED FILES:                                                      *
  46.  *      ───────────────                                                      *
  47.  *                                                                           *
  48.  *           IPF.C         - Source code                                     *
  49.  *           IPF.H         - Include file                                    *
  50.  *           IPF.MAK       - Make file                                       *
  51.  *           IPF.DEF       - Module definition file                          *
  52.  *           IPF.RC        - Resource file                                   *
  53.  *           FRAME1.BMP    - Bitmap 1 used for animation                     *
  54.  *           FRAME2.BMP    - Bitmap 2 used for animation                     *
  55.  *           FRAME3.BMP    - Bitmap 3 used for animation                     *
  56.  *           FRAME4.BMP    - Bitmap 4 used for animation                     *
  57.  *           FRAME5.BMP    - Bitmap 5 used for animation                     *
  58.  *                                                                           *
  59.  *           OS2.H         - Include file for Presentation Manager           *
  60.  *                                                                           *
  61.  *      REQUIRED LIBRARIES:                                                  *
  62.  *      ───────────────────                                                  *
  63.  *                                                                           *
  64.  *           OS2386.LIB   - Link library for OS/2 functions                  *
  65.  *           DDE4NBS.LIB  - Link library for DLL functions                   *
  66.  *           DDE4NBSO.LIB - Link library for DLL functions                   *
  67.  *                                                                           *
  68.  *      REQUIRED PROGRAMS:                                                   *
  69.  *      ──────────────────                                                   *
  70.  *                                                                           *
  71.  *           IBM C386 Compiler                                               *
  72.  *           IBM LINK386 Linker                                              *
  73.  *           Resource Compiler                                               *
  74.  *                                                                           *
  75. \*****************************************************************************/
  76.  
  77. /*---------------------------------------------------------------------------*\
  78.  * Include files, macros, defined constants, and externs                     *
  79. \*---------------------------------------------------------------------------*/
  80.  
  81. #define INCL_WIN
  82. #define INCL_GPI
  83. #define INCL_DOS
  84. #define INCL_DOSMODULEMGR
  85. #define LINT_ARGS
  86. #define DINCL_32
  87.  
  88. #include <OS2.H>
  89. #include "IPF.H"
  90.  
  91. #define COM_HWND             4  /* Used in WinSetWindowULong              */
  92. #define FRAMES               5  /* Number of frames in animation sequence */
  93. #define BEEP_WARN_FREQ      60  /* Frequency of warning beep              */
  94. #define BEEP_WARN_DUR      100  /* Duration of warning beep               */
  95.  
  96. /*---------------------------------------------------------------------------*\
  97.  * Structure and type definitions                                            *
  98. \*---------------------------------------------------------------------------*/
  99.  
  100.  
  101. /*---------------------------------------------------------------------------*\
  102.  * Variables used globally in this module                                    *
  103. \*---------------------------------------------------------------------------*/
  104.  
  105. USHORT   IPFClassRegistered = 0;         /* IPF class registered flag        */
  106. HWND     hwndClient;                     /* Handle to the client window      */
  107. HWND     hwndPrevious;                   /* Handle to the previous active    */
  108.                                          /*  object communication window     */
  109. HWND     hwndLatest;                     /* Handle to the latest active      */
  110.                                          /*  object communication window     */
  111.  
  112. /*---------------------------------------------------------------------------*\
  113.  * Forward definitions of entry points                                       *
  114. \*---------------------------------------------------------------------------*/
  115.  
  116. MRESULT EXPENTRY IPFMain (PACVP pACVP, PCH Parameter);
  117. MRESULT EXPENTRY IPFWinProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  118. VOID Error (PCH str);
  119.  
  120. /*---------------------------------------------------------------------------*\
  121.  * IPF Entry Point                                                           *
  122.  *---------------------------------------------------------------------------*
  123.  *                                                                           *
  124.  *  Name:     IPFMain ()                                                     *
  125.  *                                                                           *
  126.  *  Purpose:  To register a window class for the AC window, create an        *
  127.  *            instance of the class, and register it with IPF as an          *
  128.  *            object communication window.                                   *
  129.  *                                                                           *
  130.  *  Usage:    N/A                                                            *
  131.  *                                                                           *
  132.  *  Method:                                                                  *
  133.  *            1) Initialize                                                  *
  134.  *              - Register the window class for the main window              *
  135.  *              - Create the main window                                     *
  136.  *                                                                           *
  137.  *            2) Process                                                     *
  138.  *              - Store the window handle                                    *
  139.  *              - Store the parent handle                                    *
  140.  *              - Set the window as an active object communication window    *
  141.  *                                                                           *
  142.  *            3) Finish                                                      *
  143.  *              - Save the returned previous object communication handle     *
  144.  *                                                                           *
  145.  *  Returns:  Returns via return                                             *
  146.  *                                                                           *
  147.  *            0 - if sucessful execution completed                           *
  148.  *            1 - if error in execution                                      *
  149.  *                                                                           *
  150. \*****************************************************************************/
  151.  
  152.  
  153. MRESULT EXPENTRY IPFMain (PACVP pACVP, PCH Parameter)
  154. {
  155.  
  156.     HWND  hwndParent;         /* Handle of parent window in IPF             */
  157.     HWND  hwndFrame;          /* Handle to the frame                        */
  158.     ULONG WinStyle;           /* window style for creating frame            */
  159.     ULONG CtrlData;           /* control data for creating frame            */
  160.  
  161.     Parameter; /* Warning Level 3 Avoidance */
  162.  
  163.  
  164. /** 1) Initialize **/
  165.  
  166.  
  167. /*****************************************************************************\
  168.  * Register the window class for the application if not already registered.  *
  169. \*****************************************************************************/
  170.  
  171.     if (!IPFClassRegistered)
  172.     {
  173.         if (!WinRegisterClass (pACVP->hAB,
  174.                                "CLASS_IPF",
  175.                                (PFNWP) IPFWinProc,
  176.                                CS_SYNCPAINT | CS_SIZEREDRAW | CS_MOVENOTIFY,
  177.                                8))
  178.         {
  179.             DosBeep (BEEP_WARN_FREQ, BEEP_WARN_DUR);
  180.             exit (TRUE);
  181.         }
  182.         IPFClassRegistered = 1;
  183.     }
  184.  
  185. /*****************************************************************************\
  186.  * Set the frame window style to not visible.                                *
  187. \*****************************************************************************/
  188.  
  189.     WinStyle = 0L;
  190.  
  191. /*****************************************************************************\
  192.  * Set the frame window to have no tilte bar or buttons.                     *
  193. \*****************************************************************************/
  194.  
  195.     CtrlData = 0L;
  196.  
  197. /*****************************************************************************\
  198.  * Create a window frame and a client window. Return the handle to the       *
  199.  * window frame. Use the ACVP structure for obtaining the handle of the IPF  *
  200.  * parent window. The window frame will become the parent to the client      *
  201.  * window.                                                                   *
  202. \*****************************************************************************/
  203.  
  204.     if (!(hwndFrame = WinCreateStdWindow (pACVP->hWndParent,
  205.                                           WinStyle,
  206.                                           &CtrlData,
  207.                                           "CLASS_IPF",
  208.                                           "IPF",
  209.                                           0L,
  210.                                           0L,
  211.                                           0L,
  212.                                           &hwndClient
  213.                                           )))
  214.     {
  215.         Error ("Can not create window");
  216.         return (MRESULT) TRUE;
  217.     }
  218.  
  219.  
  220. /** 2) Process **/
  221.  
  222.  
  223. /*****************************************************************************\
  224.  * Set the handle of the AC window to the handle of the window frame. Use    *
  225.  * the ACVP structure for passing the information.                           *
  226. \*****************************************************************************/
  227.  
  228.     pACVP->hWndACVP = hwndFrame;
  229.  
  230. /*****************************************************************************\
  231.  * Set the handle of the parent window to the handle of the AC window. Use   *
  232.  * the ACVP structure for passing the information.                           *
  233. \*****************************************************************************/
  234.  
  235.     hwndParent = pACVP->hWndParent;
  236.  
  237. /*****************************************************************************\
  238.  *                                                                           *
  239.  * The following comment includes a sample scenario to provide a broader     *
  240.  * explanation of the object communication process.                          *
  241.  *                                                                           *
  242.  * Send a message to the IPF parent window that this window frame is the     *
  243.  * latest active object communication window (B) in the chain to which       *
  244.  * messages are to be sent to. The handle of the previous active object      *
  245.  * communication window (A) is returned. This window frame remains the       *
  246.  * latest active object communication window (B) until a new active object   *
  247.  * communication window (C) wants to join the communication chain.           *
  248.  *                                                                           *
  249.  *                                 -                                         *
  250.  * Communication chain:       A -> B                                         *
  251.  *                                 -                                         *
  252. \*****************************************************************************/
  253.  
  254.     hwndPrevious = (HWND) WinSendMsg (pACVP->hWndParent,
  255.                                       HM_SET_OBJCOM_WINDOW,
  256.                                       (MPARAM) hwndFrame,
  257.                                       (MPARAM)NULL);
  258.  
  259. /*****************************************************************************\
  260.  * Check if the preceeding WinSendMsg was successful. Look for the current   *
  261.  * window as the latest active object communication window in the chain.     *
  262. \*****************************************************************************/
  263.  
  264.     hwndLatest = (HWND) WinSendMsg (pACVP->hWndParent,
  265.                                     HM_QUERY,
  266.                                     MPFROM2SHORT ((USHORT)0, HMQW_OBJCOM_WINDOW),
  267.                                     (MPARAM)NULL);
  268.  
  269.     if (hwndFrame != hwndLatest)
  270.     {
  271.         Error ("Can not set object communication window");
  272.         return (MRESULT) TRUE;
  273.     }
  274.  
  275.  
  276. /** 3) Finish **/
  277.  
  278.  
  279. /*****************************************************************************\
  280.  * Save the handle of the previous active object communciation window into   *
  281.  * reserved memory for the client window.                                    *
  282. \*****************************************************************************/
  283.  
  284.     if (!WinSetWindowULong (hwndClient, COM_HWND, (ULONG) hwndPrevious))
  285.     {
  286.         Error ("Can not save handle into reserved memory");
  287.         return (MRESULT) TRUE;
  288.     }
  289.     return (MRESULT) FALSE;
  290. }
  291.  
  292.  
  293. /****************************** End of IPFMain *******************************/
  294.  
  295.  
  296. /*---------------------------------------------------------------------------*\
  297.  * Client Window Procedure                                                   *
  298.  *---------------------------------------------------------------------------*
  299.  *                                                                           *
  300.  *  Name:     IPFWinProc ()                                                  *
  301.  *                                                                           *
  302.  *  Purpose:  To perform animation in the IPF AC window.                     *
  303.  *                                                                           *
  304.  *  Usage:    Called from 'IPFMain' procedure.                               *
  305.  *                                                                           *
  306.  *  Method:                                                                  *
  307.  *            1) Initialize                                                  *
  308.  *              - Check the previous object communication window             *
  309.  *              - Get the handle to the bitmaps in the DLL resource          *
  310.  *              - Load the bitmaps                                           *
  311.  *              - Set and start the timer                                    *
  312.  *                                                                           *
  313.  *            2) Process                                                     *
  314.  *              - Update to the next bitmap frame                            *
  315.  *              - Draw the new bitmap                                        *
  316.  *                                                                           *
  317.  *            3) Finish                                                      *
  318.  *              - Destroy the window                                         *
  319.  *              - Stop the timer                                             *
  320.  *              - Delete the bitmaps                                         *
  321.  *              - Restore the previous object communication window           *
  322.  *              - Free the DLL resource                                      *
  323.  *                                                                           *
  324.  *  Returns:  Returns via return                                             *
  325.  *                                                                           *
  326.  *            0 - if sucessful execution completed                           *
  327.  *            1 - if error in execution                                      *
  328.  *                                                                           *
  329. \*****************************************************************************/
  330.  
  331.  
  332. MRESULT EXPENTRY IPFWinProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  333. {
  334.  
  335.     static HAB      Hhab;         /* anchor block handle                    */
  336.     static HBITMAP  hbm [5];      /* array of bitmap handles                */
  337.     static HPS      hps;          /* presentation space                     */
  338.     static POINTL   ptl;          /* pointl                                 */
  339.     static HMODULE  hModule;      /* to get bitmaps from DLL resource       */
  340.     static SHORT    index;        /* index to current bitmap to display     */
  341.     static LONG     cxClient,
  342.                     cyClient;     /* window size                            */
  343.            BOOL     rValue=TRUE;  /* FALSE if the message was acted         */
  344.                                   /* upon successfully                      */
  345.  
  346.  
  347. /** 1) Initialize **/
  348.  
  349.  
  350.     switch (msg)
  351.     {
  352.         case HM_UPDATE_OBJCOM_WINDOW_CHAIN:
  353.  
  354. /*****************************************************************************\
  355.  * Retrieve the handle to the previous object communications window.         *
  356. \*****************************************************************************/
  357.  
  358.             hwndPrevious = (HWND) WinQueryWindowULong (hwnd, COM_HWND);
  359.  
  360. /*****************************************************************************\
  361.  *                                                                           *
  362.  * The following comment includes a sample scenario to provide a broader     *
  363.  * explanation of the object communication process.                          *
  364.  *                                                                           *
  365.  * If the previous object communication window (A) is terminating for this   *
  366.  * object communication window (B), then update the saved previous object    *
  367.  * communication window handle (A) to the new previous object communication  *
  368.  * window handle (NULL). Otherwise ignore the message and pass it onto the   *
  369.  * preceeding object communication window (A).                               *
  370.  *                                                                           *
  371.  *                                 -                                         *
  372.  * Communication chain:       A -> B -> C -> D -> E                          *
  373.  *                                 -                                         *
  374. \*****************************************************************************/
  375.  
  376.             if (hwndPrevious == (HWND)mp2)
  377.             {
  378.                  hwndPrevious = (HWND)mp1;
  379.  
  380. /*****************************************************************************\
  381.  * Save the handle of the new previous active object communciation window    *
  382.  * into reserved memory for the client window.                               *
  383. \*****************************************************************************/
  384.  
  385.                 if (!WinSetWindowULong (hwndClient,
  386.                                         COM_HWND,
  387.                                         (ULONG) hwndPrevious))
  388.                 {
  389.                     Error ("Can not save handle into reserved memory");
  390.                     break;
  391.                 }
  392.             }
  393.             else
  394.             {
  395.                 if (hwndPrevious != 0L)
  396.                 {
  397.                     WinSendMsg (hwndPrevious,
  398.                                 HM_UPDATE_OBJCOM_WINDOW_CHAIN,
  399.                                 (MPARAM) mp1,
  400.                                 (MPARAM) mp2);
  401.                 }
  402.             }
  403.  
  404.             rValue = FALSE;
  405.             break;
  406.  
  407.         case WM_CREATE:
  408.  
  409.             if (DosLoadModule (NULL, 0L, "IPF", &hModule))
  410.             {
  411.                 Error ("Can not load module");
  412.                 break;
  413.             }
  414.  
  415. /*****************************************************************************\
  416.  * Get the presentation space and return the handle.                         *
  417. \*****************************************************************************/
  418.  
  419.             if (!(hps = WinGetPS(hwnd)))
  420.             {
  421.                 Error ("Can not get presentation space");
  422.                 break;
  423.             }
  424.  
  425. /*****************************************************************************\
  426.  * Update the frame index and load the bitmap resources from the DLL module. *
  427. \*****************************************************************************/
  428.  
  429.             for (index = 0; index < FRAMES; index++)
  430.             {
  431.                 if (!(hbm [index] = GpiLoadBitmap (hps,
  432.                                                    hModule,
  433.                                                    (USHORT)(IDB_FRAME1+index),
  434.                                                    cxClient,
  435.                                                    cyClient)))
  436.                 {
  437.                     Error ("Can not load bitmap");
  438.                     return (MRESULT) rValue;
  439.                 }
  440.             }
  441.  
  442. /*****************************************************************************\
  443.  * Release the presentation space.                                           *
  444. \*****************************************************************************/
  445.  
  446.             WinReleasePS (hps);
  447.  
  448.             index = 0;
  449.  
  450. /*****************************************************************************\
  451.  * Start a timer to send timer messages at a desired rate.                   *
  452. \*****************************************************************************/
  453.  
  454.             if (!(Hhab = WinQueryAnchorBlock (hwnd)))
  455.             {
  456.                 Error ("Can not retrieve anchor block handle");
  457.                 break;
  458.             }
  459.  
  460.             if (!WinStartTimer (Hhab, hwnd, ID_TIMER, 150))
  461.             {
  462.                 Error ("Can not start timer");
  463.                 break;
  464.             }
  465.  
  466.             rValue = FALSE;
  467.             break;
  468.  
  469. /*****************************************************************************\
  470.  * Update the index when a timer message is received.                        *
  471. \*****************************************************************************/
  472.  
  473.         case WM_TIMER:
  474.  
  475.             if (index++ == FRAMES-1)
  476.             {
  477.                 index = 0;
  478.             }
  479.  
  480. /*****************************************************************************\
  481.  * Invalidate the window to cause repainting.                                *
  482. \*****************************************************************************/
  483.  
  484.             WinInvalidateRect (hwnd, NULL, FALSE);
  485.  
  486.             rValue = FALSE;
  487.             break;
  488.  
  489.  
  490. /** 2) Process **/
  491.  
  492.  
  493. /*****************************************************************************\
  494.  * Get the presentation space whose associated update region is ready for    *
  495.  * drawing. Draw the bitmap and restore the presentation space to the prior  *
  496.  * state.                                                                    *
  497. \*****************************************************************************/
  498.  
  499.         case WM_PAINT:
  500.  
  501.             if (!(hps = WinBeginPaint (hwnd, 0L, NULL)))
  502.             {
  503.                 Error ("Can not set presentaion space for drawing");
  504.                 break;
  505.             }
  506.  
  507.             if (!WinDrawBitmap (hps,
  508.                                 hbm [index],
  509.                                 NULL,
  510.                                 &ptl,
  511.                                 CLR_NEUTRAL,
  512.                                 CLR_BACKGROUND,
  513.                                 DBM_NORMAL))
  514.             {
  515.                 Error ("Can not draw bitmap");
  516.                 break;
  517.             }
  518.  
  519.             WinEndPaint (hps);
  520.  
  521.             rValue = FALSE;
  522.             break;
  523.  
  524.         case WM_SIZE:
  525.  
  526.             cxClient = SHORT1FROMMP (mp2);
  527.             cyClient = SHORT2FROMMP (mp2);
  528.  
  529.             rValue = FALSE;
  530.             break;
  531.  
  532.  
  533. /** 3) Finish **/
  534.  
  535.  
  536. /*****************************************************************************\
  537.  * Retrieve the handle of the parent window and destroy the window.          *
  538. \*****************************************************************************/
  539.  
  540.         case WM_CLOSE:
  541.  
  542.             WinDestroyWindow (WinQueryWindow (hwnd, QW_PARENT));
  543.  
  544.             rValue = FALSE;
  545.             break;
  546.  
  547. /*****************************************************************************\
  548.  * Stop the timer and delete the bitmaps.                                    *
  549. \*****************************************************************************/
  550.  
  551.         case WM_DESTROY:
  552.  
  553.             WinStopTimer (Hhab, hwnd, ID_TIMER);
  554.  
  555.             for (index = 0; index < 8; index++)
  556.             {
  557.                 GpiDeleteBitmap (hbm [index]);
  558.             }
  559.  
  560. /*****************************************************************************\
  561.  * Retrieve the handle to the previous object communications window.         *
  562. \*****************************************************************************/
  563.  
  564.             hwndPrevious = (HWND) WinQueryWindowULong (hwnd, COM_HWND);
  565.  
  566. /*****************************************************************************\
  567.  * Query IPF for the handle of the latest active object communication window.*
  568. \*****************************************************************************/
  569.  
  570.             hwndLatest = (HWND)WinSendMsg (hwnd,
  571.                                     HM_QUERY,
  572.                                     MPFROM2SHORT ((USHORT)0, HMQW_OBJCOM_WINDOW),
  573.                                     (MPARAM)NULL);
  574.  
  575. /*****************************************************************************\
  576.  *                                                                           *
  577.  * The following comment includes a sample scenario to provide a broader     *
  578.  * explanation of the object communication process.                          *
  579.  *                                                                           *
  580.  * Send a message to the latest active object communication window (E) that  *
  581.  * this object communication window (B) has terminated. The latest active    *
  582.  * object communication window (E) will either use the information or pass   *
  583.  * it to the preceeding object communication window (D). The information     *
  584.  * will be passed along until it reaches the object communication window (C) *
  585.  * created after this object communication window (B). The later object      *
  586.  * communication window (C) must update its saved previous object            *
  587.  * communication window handle (B) to the new previous object communication  *
  588.  * window handle (A) in the communication chain.                             *
  589.  *                                                                           *
  590.  *                                 -                                         *
  591.  * Communication chain:       A -> B -> C -> D -> E                          *
  592.  *                                 -                                         *
  593. \*****************************************************************************/
  594.  
  595.             WinSendMsg (hwndLatest,
  596.                         HM_UPDATE_OBJCOM_WINDOW_CHAIN,
  597.                         (MPARAM) hwndPrevious,
  598.                         (MPARAM) WinQueryWindow (hwnd, QW_PARENT));
  599.  
  600. /*****************************************************************************\
  601.  * Free the DLL module and process any window messages that the application  *
  602.  * does not process.                                                         *
  603. \*****************************************************************************/
  604.  
  605.             DosFreeModule (hModule);
  606.  
  607.             rValue = FALSE;
  608.             break;
  609.  
  610.         default:
  611.  
  612.             rValue = TRUE;
  613.             break;
  614.  
  615.     }
  616.  
  617.     return (rValue ? WinDefWindowProc (hwnd, msg, mp1, mp2) : 0L);
  618.  
  619. }
  620.  
  621.  
  622. /***************************** End of IPFWinProc *****************************/
  623.  
  624.  
  625. /*---------------------------------------------------------------------------*\
  626.  * Error Message Procedure                                                   *
  627.  *---------------------------------------------------------------------------*
  628.  *                                                                           *
  629.  *  Name:     Error ()                                                       *
  630.  *                                                                           *
  631.  *  Purpose:  To print an error message in a message box.                    *
  632.  *                                                                           *
  633.  *  Usage:    Called from 'IPFMain' and 'IPFWinProc' procedures.             *
  634.  *                                                                           *
  635.  *  Method:   N/A                                                            *
  636.  *                                                                           *
  637.  *  Returns:  N/A                                                            *
  638.  *                                                                           *
  639. \*****************************************************************************/
  640.  
  641.  
  642. VOID Error (PCH str)
  643.  
  644. {
  645.  
  646.     WinMessageBox (HWND_DESKTOP,
  647.                    HWND_DESKTOP,
  648.                    (PCH)str,
  649.                    (PCH)"IPF Sample Error Message",
  650.                    1,
  651.                    MB_OK | MB_APPLMODAL |
  652.                    MB_MOVEABLE | MB_ICONASTERISK);
  653. }
  654.  
  655.  
  656. /************************* End of IPF Sample Program *************************/
  657.