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

  1. #include <extend.h>
  2.  
  3. #pragma optimize("lge", off)
  4.  
  5. /*  $DOC$
  6.  *  $FUNCNAME$
  7.  *      OL_ISMSWIN()
  8.  *  $CATEGORY$
  9.  *      Functions
  10.  *  $ONELINER$
  11.  *      Check to see if we are running under MS-Windows.
  12.  *  $SYNTAX$
  13.  *      OL_IsMSWin() --> lIsWin
  14.  *  $ARGUMENTS$
  15.  *      None.
  16.  *  $RETURNS$
  17.  *      A logical value, .T. if we are running under MS-Windows, .F. if
  18.  *      not.
  19.  *  $DESCRIPTION$
  20.  *      OL_IsMSWin() can be used to check if your application is been run
  21.  *      under MS-Windows. This could come in handy if you want to provide
  22.  *      your users with extra features such as pasting text into the
  23.  *      Windows clipboard.
  24.  *  $EXAMPLES$
  25.  *      // Check if we are running under MS-Windows.
  26.  *
  27.  *      If OL_IsMSWin()
  28.  *         ? "Oh well, never mind....."
  29.  *      Else
  30.  *         ? "Ahhh! This ain't Windows.... ;-)"
  31.  *      EndIf
  32.  *  $END$
  33.  */
  34.  
  35. CLIPPER OL_IsMSWin()
  36. {
  37.     int iIsWin = 0;
  38.     
  39.     _asm {
  40.         Mov     AX, 0x1600;
  41.         Int     0x2F;
  42.         Test    AL, 0x7F;
  43.         Jnz     IsWin;
  44.         Mov     AX, 0x4680;
  45.         Int     0x2F;
  46.         Or      AX, AX;
  47.         Jz      IsWin;
  48.         Jmp     CheckDone;
  49.     IsWin:
  50.         Mov     iIsWin, 1;
  51.     CheckDone:
  52.     }
  53.     
  54.     _retl( iIsWin );
  55. }
  56.