home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / HELLO1 / AHELLOW1.CPP next >
C/C++ Source or Header  |  1995-04-07  |  4KB  |  59 lines

  1. /*****************************************************************************
  2. * HELLO WORLD SAMPLE PROGRAM - Version 1: Class Implementation (ahellow1.cpp)*
  3. *                                                                            *
  4. * COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
  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. /**************************************************************************   V1
  17. * C++ Hello World History and Key Functions:                              *   V1
  18. *   Version 1: (lines with V1 in column 79-80)                            *   V1
  19. *      - Creates and runs a simple application                            *   V1
  20. *      - Creates the main window (IFrameWindow)                           *   V1
  21. *      - Creates a static text control set to "Hello, World!!!" as the    *   V1
  22. *         client window                                                   *   V1
  23. **************************************************************************/
  24. //Include User Interface Class Library class headers:
  25. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  26.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  27. #endif                                  //  is defined.
  28. #include <iapp.hpp>                     //IApplication class                  V1
  29. #include <istattxt.hpp>                 //IStaticText class                   V1
  30. #include <iframe.hpp>                   //IFrameWindow class                  V1
  31.  
  32. /**************************************************************************   V1
  33. * main  - Application entry point for Hello World Version 1.              *   v1
  34. *         This simple application does the following:                     *   V1
  35. *           1) Creates a new object mainWindow of class IFrameWindow      *   V1
  36. *           2) Creates a new object hello of class IStaticText            *   V1
  37. *           3) Sets the static text value and aligns it                   *   V1
  38. *           4) Sets the static text as the client of the mainWindow       *   V1
  39. *           5) Sets the size of mainWindow                                *   V1
  40. *           6) Sets the window focus to mainWindow                        *   V1
  41. *           7) Displays the mainWindow                                    *   V1
  42. *           8) Starts the events processing for the application           *   V1
  43. **************************************************************************/
  44. int main()                                                                  //V1
  45. {                                                                           //V1
  46.   IFrameWindow mainWindow ("Hello World Sample - Version 1", 0x1000);                                         //V1
  47.  
  48.   IStaticText hello(0x8008, &mainWindow, &mainWindow);                      //V1
  49.   hello.setText("Hello, World!!!");                                         //V1
  50.   hello.setAlignment(IStaticText::centerCenter);                            //V1
  51.   mainWindow.setClient(&hello);                                             //V1
  52.  
  53.   mainWindow.sizeTo(ISize(400,300));                                        //V1
  54.   mainWindow.setFocus();                                                    //V1
  55.   mainWindow.show();                                                        //V1
  56.   IApplication::current().run();                                            //V1
  57.   return 0;
  58. } /* end main */                                                            //V1
  59.