home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VIOUTL.ZIP / POP.C < prev    next >
C/C++ Source or Header  |  1989-06-28  |  2KB  |  85 lines

  1. /* ----------------------------------------------------------------------
  2. .context pop
  3. .category VioUtil
  4. void far pop ( PUCHAR pch )
  5.  
  6. Description: 
  7.      This routine allows a process to alert the user of an event.  The
  8. VioPopUp call into OS/2 is used as the mechanism to the user.
  9.  
  10. Parameter     Description
  11. -------------------------------------------------------------------------
  12. pch           a 32 bit pointer to a zero terminated charater string
  13.  
  14. Returns: 
  15.      nothing
  16.  
  17. Comments: 
  18.  
  19. References: 
  20.  
  21. See Also: box
  22. .ref box
  23.  
  24. Development History: 
  25.   Date         Programmer          Description of modification   
  26.   06/16/1989   Paul Montgomery     Initial development           
  27. -------------------------------------------------------------------- */
  28.  
  29. #define INCL_DOS
  30. #define INCL_SUB
  31. #include <os2.h>
  32. #include <string.h>
  33.  
  34. #include "box.h"
  35.  
  36. void far pop ( PUCHAR pch )
  37.    {
  38.    USHORT     pwait;
  39.    KBDKEYINFO KeyInfo;
  40.    BYTE       bBlank[2];
  41.    int        a1;
  42.    int        b1;
  43.    int        a2;
  44.    int        b2;
  45.    USHORT     len;
  46.    int        col;
  47.  
  48.    for (len=0; pch[len] != 0; len++);
  49.  
  50.    pwait = VP_WAIT | VP_OPAQUE;
  51.    a1 = (80 - (len + 12)) / 2;
  52.    a2 = a1 + (len + 12);
  53.    b1 = 3;
  54.    b2 = 16;
  55.  
  56.    VioPopUp ( &pwait, 0 );
  57.  
  58.    bBlank[0] = 0x20;                      /* space character       */
  59.    bBlank[1] = 0x02;                      /* green attribute (EGA) */
  60. //   Exp_Box ( &bBlank, a1,b1,a2,b2, "POPUP" );
  61.    box ( &bBlank, a1,b1,a2,b2, "POPUP" );
  62.  
  63.    col = ( a2 - a1 ) / 2;
  64.    VioSetCurPos(b1 + ((b2-b1)/2),                      /* cursor row    */
  65.        col - ( len / 2 ) + a1 ,
  66.        0);
  67.    VioWrtTTY ( "\x01b[32;40;m",9 ,0);
  68.    VioWrtTTY ( pch, len, 0 );
  69.  
  70.    VioSetCurPos(b2-2,                         /* cursor row    */
  71.        col - ( 3 ) + a1 ,
  72.        0);
  73.    VioWrtTTY ( "Any Key" ,7,0 );
  74.  
  75.    VioSetCurPos(b2-1,                         /* cursor row    */
  76.        col - ( 4 ) + a1 ,
  77.        0);
  78.    VioWrtTTY ( "To Resume" ,9,0 );
  79.    VioWrtTTY ( "\x01b[37;40;m",9 ,0);
  80.  
  81.    KbdCharIn(&KeyInfo, IO_WAIT, 0);
  82.  
  83.    VioEndPopUp ( 0 );
  84.    }
  85.