home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2BAS.ZIP / WELCOME1.BAS < prev    next >
BASIC Source File  |  1989-09-11  |  3KB  |  88 lines

  1. '------------------------------------------------------------
  2. ' WELCOME1.BAS -- A Program that writes to its Client Window
  3. '------------------------------------------------------------
  4. REM $INCLUDE: 'PMBase.BI'
  5. REM $INCLUDE: 'WinFrame.BI'
  6. REM $INCLUDE: 'WinMan1.BI'
  7. REM $INCLUDE: 'WinPoint.BI'
  8. REM $INCLUDE: 'GpiColor.BI'
  9. REM $INCLUDE: 'BseDosPC.BI'
  10.  
  11. DIM aqmsg AS QMSG
  12.  
  13. szClientClass$ = "Welcome" + CHR$(0)
  14.  
  15. flFrameFlags& = FCFTITLEBAR     OR FCFSYSMENU OR _
  16.         FCFSIZEBORDER     OR FCFMINMAX  OR _
  17.         FCFSHELLPOSITION OR FCFTASKLIST
  18.  
  19. hab& = WinInitialize(0)
  20. hmq& = WinCreateMsgQueue(hab&, 0)
  21.  
  22. bool% = WinRegisterClass(_
  23.              hab&,_                             ' Anchor block handle
  24.              MakeLong(VARSEG(szClientClass$),_  ' Name of class being registered
  25.                         SADD(szClientClass$)),_
  26.              RegBas,_                           ' Window procedure for class
  27.              CSSIZEREDRAW,_                     ' Class style
  28.              0)                                 ' Extra bytes to reserve
  29.  
  30. hwndFrame& = WinCreateStdWindow (_
  31.              HWNDDESKTOP,_                      ' Parent window handle
  32.              WSVISIBLE,_                        ' Style of frame window
  33.              MakeLong (VARSEG(flFrameFlags&),_  ' Pointer to control data
  34.                        VARPTR(flFrameFlags&)),_
  35.              MakeLong (VARSEG(szClientClass$),_ ' Client window class name
  36.                          SADD(szClientClass$)),_
  37.              0,_                                ' Title bar text
  38.              0,_                                ' Style of client window
  39.              0,_                                ' Module handle for resources
  40.              0,_                                ' ID of resources
  41.              MakeLong (VARSEG(hwndClient&),_    ' Pointer to client window handle
  42.                        VARPTR(hwndClient&)))
  43.  
  44. bool% = WinSendMsg(hwndFrame&, WMSETICON,_
  45.             WinQuerySysPointer(HWNDDESKTOP, SPTRAPPICON, FALSE),_
  46.             0)
  47.  
  48. WHILE (WinGetMsg(hab&, MakeLong(VARSEG(aqmsg), VARPTR(aqmsg)), 0, 0, 0))
  49.   bool% = WinDispatchMsg(hab&, MakeLong(VARSEG(aqmsg), VARPTR(aqmsg)))
  50. WEND
  51.  
  52. bool% = WinDestroyWindow(hwndFrame&)
  53. bool% = WinDestroyMsgQueue(hmq&)
  54. bool% = WinTerminate(hab&)
  55.  
  56. END
  57.  
  58. FUNCTION ClientWndProc&(hwnd&, msg%, mp1&, mp2&)
  59.      szText$ = "Welcome to the OS/2 Presentation Manager" + CHR$(0)
  60.      DIM rcl AS RECTL
  61.      ClientWndProc&=0
  62.      SELECT CASE msg%
  63.     CASE WMCREATE
  64.         b% = DosBeep(261, 100)
  65.         b% = DosBeep(330, 100)
  66.         b% = DosBeep(392, 100)
  67.         b% = DosBeep(523, 100)
  68.     CASE WMPAINT
  69.         hps& = WinBeginPaint(hwnd&, 0, 0)
  70.             bool% = WinQueryWindowRect(hwnd&, MakeLong(VARSEG(rcl), VARPTR(rcl)))
  71.             bool% = WinDrawText(hps&,_
  72.                                 -1,_
  73.                                 MakeLong(VARSEG(szText$), SADD(szText$)),_
  74.                                 MakeLong(VARSEG(rcl), VARPTR(rcl)),_
  75.                                 CLRNEUTRAL,_
  76.                                 CLRBACKGROUND,_
  77.                                 DTCENTER OR DTVCENTER OR DTERASERECT)
  78.             bool% = WinEndPaint(hps&)
  79.     CASE WMDESTROY
  80.         b% = DosBeep(523, 100)
  81.         b% = DosBeep(392, 100)
  82.         b% = DosBeep(330, 100)
  83.         b% = DosBeep(261, 100)
  84.     CASE ELSE
  85.         ClientWndProc& = WinDefWindowProc(hwnd&, msg%, mp1&, mp2&)
  86.     END SELECT
  87. END FUNCTION
  88.