home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / OSLIB101.ZIP / SOURCE / ISOS2WIN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-14  |  1.6 KB  |  60 lines

  1. #pragma optimize("lge", off)
  2.  
  3. #include <extend.api>
  4.  
  5. /*  $DOC$
  6.  *  $FUNCNAME$
  7.  *      OL_IsOS2Win()
  8.  *  $CATEGORY$
  9.  *      Functions
  10.  *  $ONELINER$
  11.  *      Are we running in a windowed OS/2 Dos session?
  12.  *  $SYNTAX$
  13.  *      OL_IsOS2Win() --> lWindow
  14.  *  $ARGUMENTS$
  15.  *      None.
  16.  *  $RETURNS$
  17.  *      .T. if we are running in an OS/2 Dos Window, .F. if we are running
  18.  *      in an OS/2 Dos full screen session.
  19.  *  $DESCRIPTION$
  20.  *      OL_IsOS2Win() can be used to check if the current Dos session
  21.  *      under OS/2 is a windowed session or a full screen
  22.  *      session. Note that this function does not check if we are
  23.  *      running under OS/2 and the return value is undocumented if we
  24.  *      are not. You will probably want to check using OL_IsOS2() first.
  25.  *  $EXAMPLES$
  26.  *      // Display the current session details.
  27.  *
  28.  *      If OL_IsOS2()
  29.  *         ? "Running in an OS/2 Dos " + if( OL_IsOS2Win()   ,;
  30.  *                                           "windowed"      ,;
  31.  *                                           "full screen" ) +;
  32.  *                                           " session"
  33.  *      Else
  34.  *         ? "Boring old Dos!"
  35.  *      EndIf
  36.  *  $SEEALSO$
  37.  *      
  38.  * $END$ */
  39.  
  40. CLIPPER OL_IsOS2Wi()
  41. {
  42.     int iIsWin;
  43.     
  44.     _asm {
  45.         Mov     DX, 0x03D6;
  46.         Mov     AL, 0x82;
  47.         Out     DX, AL;
  48.         In      AL, DX;
  49.         Cmp     AL, 00;
  50.         Je      IsWin;
  51.         Mov     iIsWin, 0;
  52.         Jmp     Done;
  53.     IsWin:
  54.         Mov     iIsWin, 1;
  55.     Done:
  56.     }
  57.     
  58.     _retl( iIsWin );
  59. }
  60.