home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / JDirect / simple / Simple.java < prev   
Encoding:
Java Source  |  2000-05-04  |  780 b   |  29 lines

  1. /* (C) Copyright 1995 - 1999 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.