home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 November / ENTER11_1.bin / WARSZTAT / SDKJava32.exe / data1.cab / fg_Win32Src / Src / Win32Api / Win32Lib.java < prev    next >
Encoding:
Java Source  |  1999-03-17  |  2.5 KB  |  82 lines

  1. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  2.  
  3. // These classes provide direct, low-overhead access to commonly used
  4. // Windows api. These classes use the new J/Direct feature.
  5. //
  6. // Information on how to use J/Direct to write your own declarations
  7. // can be found in the Microsoft SDK for Java 2.0 or later.
  8.  
  9. package com.ms.win32;
  10.  
  11.  
  12. /** @security(checkClassLinking=on) */
  13. public class Win32Lib
  14. {
  15.     public static short MAKEWORD(int nLow, int nHigh)
  16.     {
  17.         // concatenate high bit of high byte, low 7 bits of high byte, and
  18.         //  low byte.
  19.         return (short)((((nHigh & 0x80) != 0x0) ? 0xFFFF8000 : 0x0) |
  20.                                 ((nHigh & 0x7F) << 8) |
  21.                                 (nLow & 0xFF));
  22.     }
  23.  
  24.     public static int MAKELONG(int nLow, int nHigh)
  25.     {
  26.         return (nHigh << 16) | (nLow & 0xFFFF);
  27.     }
  28.  
  29.     public static int LOWORD(int n)
  30.     {
  31.         return n & 0xFFFF;
  32.     }
  33.  
  34.     public static int HIWORD(int n)
  35.     {
  36.         return (n >> 16) & 0xFFFF;
  37.     }
  38.  
  39.     public static int LOBYTE(int n)
  40.     {
  41.         return n & 0xFF;
  42.     }
  43.  
  44.     public static int HIBYTE(int n)
  45.     {
  46.         return (n >> 8) & 0xFF;
  47.     }
  48.  
  49.     public static int MAKEWPARAM(int nLow, int nHigh)
  50.     {
  51.         return (nHigh << 16) | (nLow & 0xFFFF);
  52.     }
  53.  
  54.     public static int MAKELPARAM(int nLow, int nHigh)
  55.     {
  56.         return (nHigh << 16) | (nLow & 0xFFFF);
  57.     }
  58.  
  59.     // returns encoded CommCtrl version (lower 2 bytes are minor
  60.     //  version, upper 2 bytes are major).
  61.     // returns 0 on failure.
  62.     private static native int   getSystemCommCtrlVersion();
  63.  
  64.     /**
  65.      * Contains the installed version of comctl32.dll, which can be used
  66.      *  to determine the installed version of Internet Explorer.
  67.      *  Some Win32 "constants" have values dependent on the installed version
  68.      *  of Internet Explorer.
  69.      * The lower 2 bytes are the minor version, the upper 2 bytes the major.
  70.      */
  71.     public static final int     systemCommCtrlVersion = getSystemCommCtrlVersion();
  72.  
  73.     /**
  74.      * Constants used to determine installed version of Internet Explorer, for
  75.      *  use with systemCommCtrlVersion.
  76.      */
  77.     public static final int     WIN32_IE200 = 0x00040000;   // base win95/NT4
  78.     public static final int     WIN32_IE300 = 0x00040046;   // IE3.x
  79.     public static final int     WIN32_IE400 = 0x00040047;   // IE4
  80.     public static final int     WIN32_IE401 = 0x00040048;   // IE4.01
  81. }
  82.