home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / javasamp.zip / Java.C < prev    next >
C/C++ Source or Header  |  1996-11-08  |  4KB  |  105 lines

  1. #pragma    title("Java - PM Sample  --  Version 1.0  --  (Java.C)")
  2. #pragma    subtitle("   main - Interface Definitions")
  3.  
  4. #pragma    info(nopar)
  5.  
  6. #define    INCL_DOS           /* Include OS/2 DOS Kernal        */
  7. #define    INCL_WIN           /* Include OS/2 PM Windows Interface    */
  8.  
  9. #include <os2.h>
  10.  
  11. #include "appdefs.h"
  12. #include "java.h"
  13.  
  14. #include "jempower.h"
  15.  
  16. /* This    module contains    routine    used to                    */
  17.  
  18. /* Filename:   Java.C                            */
  19.  
  20. /*  Version:   1.0                            */
  21. /*  Created:   1996-10-10                        */
  22. /*  Revised:   1996-10-10                        */
  23.  
  24. /* Routines:   INT main(INT argc, CHAR *argv[ ]);            */
  25.  
  26.  
  27. /************************************************************************/
  28. /************************************************************************/
  29. /************************************************************************/
  30. /* DISCLAIMER OF WARRANTIES:                        */
  31. /* -------------------------                        */
  32. /* The following [enclosed] code is sample code    created    by IBM        */
  33. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  34. /* standard IBM    product    and is provided    to you solely for the purpose    */
  35. /* of assisting    you in the development of your applications.  The code    */
  36. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  37. /* Prominare shall be liable for any damages arising out of your    */
  38. /* use of the sample code, even    if they    have been advised of the    */
  39. /* possibility of such damages.                        */
  40. /************************************************************************/
  41. /************************************************************************/
  42. /************************************************************************/
  43. /*               D I S C L A I M E R                */
  44. /* This    code is    provided on an as is basis with    no implied support.    */
  45. /* It should be    considered freeware that cannot    be rebundled as        */
  46. /* part    of a larger "*ware" offering without our consent.        */
  47. /************************************************************************/
  48. /************************************************************************/
  49. /************************************************************************/
  50.  
  51. /* Copyright ╕ International Business Machines Corp., 1996.        */
  52. /* Copyright ╕ 1996  Prominare Inc.  All Rights    Reserved.        */
  53.  
  54. /* --------------------------------------------------------------------    */
  55.  
  56. PSZ pszJavaClassName = (PSZ)"Java";
  57.  
  58.  
  59. INT main(INT argc, CHAR    *argv[ ])
  60.  
  61. {
  62. QMSG  qmsg;               /* PM Message Queue Holder        */
  63.  
  64. jeInitJavaRuntime( );
  65.  
  66.                /* Initialize the program for PM    and create the    */
  67.                /* message queue                    */
  68.  
  69. hmqJava    = WinCreateMsgQueue(hAB    = WinInitialize(0UL), 0L);
  70.  
  71.                /* Register the window class            */
  72.  
  73. if ( !WinRegisterClass(hAB, pszJavaClassName, (PFNWP)JavaPMSampleWndProc, CS_SYNCPAINT | CS_SIZEREDRAW,    8UL) )
  74.    return(0);
  75.                /* Create the main program window        */
  76.  
  77. if ( !(hwndJavaFrame = CreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
  78.                        FCF_NOBYTEALIGN | FCF_TASKLIST |    FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU |    FCF_SIZEBORDER,
  79.                        pszJavaClassName, (PSZ)"Java - PM Sample", 0L,
  80.                        (HMODULE)NULL, WIN_JAVAPMSAMPLE,    &hwndJava, 92, 30, 220,    107)) )
  81.    return(0);
  82.  
  83. InitApp(hwndJavaFrame, hwndJava, NULL);
  84.  
  85.                /* Get and dispatch the message to program    */
  86.                /* windows                    */
  87.  
  88. while (    WinGetMsg(hAB, &qmsg, (HWND)NULL, 0UL, 0UL) )
  89.    WinDispatchMsg(hAB, &qmsg);
  90.  
  91.                /* Have received    a WM_QUIT, start the program    */
  92.                /* shutdown by destroying the program windows    */
  93.                /* and destroying the message queue        */
  94.  
  95. WinDestroyWindow(hwndJavaFrame);
  96.  
  97. WinDestroyMsgQueue(hmqJava);
  98.  
  99.                /* Notify PM that main program thread not needed    */
  100.                /* any longer                    */
  101. WinTerminate(hAB);
  102.                /* Exit back to OS/2 cleanly            */
  103. return(0);
  104. }
  105.