home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ICLUI.ZIP / HELLO1 / AHELLOW1.CPP next >
Text File  |  1993-02-22  |  3KB  |  50 lines

  1. /******************************************************************************/
  2. /* HELLO WORLD SAMPLE PROGRAM - Version 2: Class Implementation (AHELLOW2.CPP)*/
  3. /*                                                                            */
  4. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
  5. /*                                                                            */
  6. /* DISCLAIMER OF WARRANTIES:                                                  */
  7. /*   The following [enclosed] code is sample code created by IBM              */
  8. /*   Corporation.  This sample code is not part of any standard IBM product   */
  9. /*   and is provided to you solely for the purpose of assisting you in the    */
  10. /*   development of your applications.  The code is provided "AS IS",         */
  11. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  12. /*   arising out of your use of the sample code, even if they have been       */
  13. /*   advised of the possibility of such damages.                              */
  14. /******************************************************************************/
  15. // NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE
  16. //**************************************************************************
  17. // C++ Hello World History and Key Functions:                              *
  18. //   Version 1:                                                            *
  19. //      - Creates and runs a simple application                            *
  20. //      - Creates the main window (IFrameWindow)                           *
  21. //      - Creates a static text control set to "Hello, World!" as the      *
  22. //         client window                                                   *
  23. //**************************************************************************
  24.                                         //Include IBM UI class headers:
  25. #include <iapp.hpp>                     //IApplication Class
  26. #include <istattxt.hpp>                 //IStaticText Class
  27. #include <iframe.hpp>                   //Include IFrameWindow Class Header
  28.  
  29. //*************************************************************************
  30. // main  - Application entry point                                        *
  31. //*************************************************************************
  32. void main()                             //Main procedure with no parameters
  33. {
  34.   IFrameWindow * mainWindow=new         //Create our main window on the desktop
  35.     IFrameWindow(0x1000);               //  Pass in our Window ID
  36.  
  37.   IStaticText * hello=new IStaticText(  //Create static text control with
  38.     0x1010, mainWindow, mainWindow);    //  mainWindow as owner & parent
  39.   hello->setText("Hello, World!");      //Set text in Static Text Control
  40.   hello->setAlignment(                  //Set Alignment to Center in both
  41.     IStaticText::centerCenter);         //  directions
  42.  
  43.   mainWindow->setClient(hello);         //Set hello control as Client Window
  44.   mainWindow->setFocus();               //Set focus to main window
  45.   mainWindow->show();                   //Set to show main window
  46.  
  47.   IApplication::current().run();        //Get the current application and
  48.                                         // run it
  49. } /* end main */
  50.