home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / sdkjava.exe / SDKJava.cab / Samples / JDirect / Simple / Simple.java < prev   
Encoding:
Java Source  |  1998-03-05  |  777 b   |  29 lines

  1. /* Copyright (C) 1997-1998 Microsoft Corporation. All rights reserved.
  2.  *
  3.  * This example calls the MessageBox api using the new @dll.import
  4.  * directive.
  5.  *
  6.  */
  7.  
  8. public class Simple
  9. {
  10.     public static void main(String args[])
  11.     {
  12.         try {
  13.  
  14.             MessageBox(0, "MessageBox successfully called.", "Java", 0);
  15.  
  16.         } catch (UnsatisfiedLinkError ule) {
  17.             System.err.println("Caught exception: " + ule);
  18.             System.err.println("Probably wrong version of Java compiler.");
  19.         }
  20.     }
  21.  
  22.  
  23.     /** @dll.import("USER32") */
  24.     static native int MessageBox(int    hwndOwner,
  25.                                  String text,
  26.                                  String title,
  27.                                  int    style);
  28. }
  29.