home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sniff16.zip / TESTAPP / DISP.C next >
C/C++ Source or Header  |  1993-03-12  |  6KB  |  212 lines

  1. /*=========================================================================\
  2.  *                                                                         *
  3.  *       FILE:disp.c                                                       *
  4.  *                                                                         *
  5.  *       DESCRIPTION:                                                      *
  6.  *                                                                         *
  7.  *                                                                         *
  8.  *                                                                         *
  9.  *-------------------------------------------------------------------------*
  10.  *      Created 1991  IBM Corp.                                            *
  11.  *                                                                         *
  12.  *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is        *
  13.  *      sample code created by IBM Corporation. This sample code is not    *
  14.  *      part of any standard or IBM product and is provided to you solely  *
  15.  *      for  the purpose of assisting you in the development of your       *    *
  16.  *      applications.  The code is provided "AS IS", without               *
  17.  *      warranty of any kind.  IBM shall not be liable for any damages     *
  18.  *      arising out of your use of the sample code, even if they have been *
  19.  *      advised of the possibility of   such damages.                      *                               *
  20.  *-------------------------------------------------------------------------*
  21.  *
  22.  *  This source file contains the following functions:
  23.  *
  24.  *
  25.  *  Disp()
  26.  *
  27.  *
  28. \*==============================================================*/
  29.  
  30. /*--------------------------------------------------------------*\
  31.  *  Include files, macros, defined constants, and externs
  32. \*--------------------------------------------------------------*/
  33. #define  INCL_VIO
  34. #define  INCL_KBD
  35. #define  INCL_MOU
  36. #define  INCL_DOSPROCESS
  37. #include <os2.h>
  38. #include <string.h>
  39. #include "worms.h"
  40. #include "wrmthrd.h"
  41.  
  42.  
  43. /*--------------------------------------------------------------*\
  44.  *  Global variables  and definitions for this file
  45. \*--------------------------------------------------------------*/
  46. /*
  47.  *use a character cell
  48.  *combo attribute for the
  49.  *heading
  50.  */
  51.  
  52. CHAR *pszMainWindow1=
  53. " \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27W\27O\27R\27M\27S\27 \27 \27\
  54.  \27 \27 \27 \27M\27I\27X\27E\27D\27 \27M\27O\27D\27E\27 \27 \27 \27 \27P\27R\27O\27G\27R\27A\27M\27 \27 \27 \27\
  55.  \27 \27 \27 \27 \27 \27 \27 \27S\27A\27M\27P\27L\27E\27 \27 \27 \27 \27 \27 \27 \27 \27 \27";
  56.  
  57. CHAR *pszMainWindow2=
  58. "─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27\
  59. ─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27\
  60. ─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27─\27";
  61.  
  62.  
  63. CHAR *pszMainWindow3=
  64. " \27 \27 \27 \27 \27A\24d\27d\27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27D\24e\27l\27e\27t\27e\27\
  65.  \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27 \27E\24x\27i\27t\27 \27 \27 \27 \27 \27\
  66.  \27 \27 \27 \24 \24 \27H\24e\27l\27p\27 \27 \27 \27 \27 \27 \27 \27 \27 \27";
  67.  
  68. USHORT usSize;
  69. #define SIZ_WIND_BUFFER      8192
  70.  
  71. /*--------------------------------------------------------------*\
  72.  *  Entry point declarations
  73. \*--------------------------------------------------------------*/
  74.  
  75. /****************************************************************\
  76.  *  Routine Name:DispMainWindow()
  77.  *--------------------------------------------------------------
  78.  *
  79.  *  Name:WindMainDisp()
  80.  *
  81.  *  Purpose:
  82.  *    Display the main window for the worms program.
  83.  *
  84.  *
  85.  *  Usage:
  86.  *
  87.  *  Method:
  88.  *          -
  89.  *
  90.  *          -
  91.  *          -
  92.  *
  93.  *          -
  94.  *          -
  95.  *
  96.  *  Returns:
  97.  *
  98.  *
  99. \****************************************************************/
  100. VOID WindMainDisp( VOID )
  101. {
  102.      BYTE bCell[2];
  103.  
  104.      bCell[0] = 0x20;
  105.      bCell[1] = ( WM_BLUE << 4 ) + WM_WHITE ;
  106.  
  107.      /*
  108.       *clear the screen
  109.       */
  110.      VioScrollDn(TOP_ROW,LEFT_COL,0xFFFF,0xFFFF,0xFFFF,bCell,hvio);
  111.      /*
  112.       *display the main window
  113.       */
  114.      VioWrtCellStr(pszMainWindow1,strlen(pszMainWindow1),
  115.                        TOP_ROW,LEFT_COL,hvio );
  116.  
  117.      VioWrtCellStr(pszMainWindow2,strlen(pszMainWindow2),
  118.                        TOP_ROW + 1,LEFT_COL,hvio );
  119.  
  120.      VioWrtCellStr(pszMainWindow3,strlen(pszMainWindow3),
  121.                        TOP_ROW + 2,LEFT_COL,hvio );
  122. }
  123.  
  124. /****************************************************************\
  125.  *
  126.  *--------------------------------------------------------------
  127.  *
  128.  *  Name:SaveScreen()
  129.  *
  130.  *  Purpose:
  131.  *
  132.  *
  133.  *
  134.  *  Usage:
  135.  *
  136.  *  Method:
  137.  *          -
  138.  *
  139.  *          -
  140.  *          -
  141.  *
  142.  *          -
  143.  *          -
  144.  *
  145.  *  Returns:
  146.  *          FALSE - if sucessful execution completed
  147.  *          TRUE  - if error
  148. \****************************************************************/
  149. BOOL
  150. SaveScreen( PVOID *ppvWindow )
  151. {
  152.  
  153.  
  154.      usSize = SIZ_WIND_BUFFER;
  155.  
  156.      /*
  157.       *allocate a buffer big enough to
  158.       *save the full screen size plus the attribute
  159.       */
  160.      if(DosAllocMem(ppvWindow,(ULONG)usSize,fALLOC)  )
  161.      {
  162.           return(TRUE);
  163.  
  164.      }
  165.      VioReadCellStr(*ppvWindow,&usSize,TOP_ROW,LEFT_COL,
  166.                                    hvio );
  167.      return(FALSE);
  168.  
  169. }
  170. /****************************************************************\
  171.  *
  172.  *--------------------------------------------------------------
  173.  *
  174.  *  Name:ReDisplayScreen()
  175.  *
  176.  *  Purpose:
  177.  *
  178.  *
  179.  *
  180.  *  Usage:
  181.  *
  182.  *  Method:
  183.  *          -
  184.  *
  185.  *          -
  186.  *          -
  187.  *
  188.  *          -
  189.  *          -
  190.  *
  191.  *  Returns:
  192.  *           VOID
  193.  *
  194. \****************************************************************/
  195. VOID
  196. ReDisplayScreen(PVOID pvWindBuf )
  197. {
  198.  
  199.  
  200.       VioWrtCellStr(pvWindBuf,usSize,TOP_ROW,LEFT_COL,
  201.                                    hvio );
  202.  
  203.       /*
  204.        *free up the memory we allocated
  205.        */
  206.       DosFreeMem(pvWindBuf);
  207.  
  208. }
  209. /*--------------------------------------------------------------*\
  210.  *  End of file : disp.c
  211. \*--------------------------------------------------------------*/
  212.