GUI "Sample"
    
 DIM Form1 AS CONTROL
 DIM Group1 AS CONTROL
 DIM Button1 AS CONTROL
 DIM Button2 AS CONTROL
 DIM Button3 AS CONTROL
 DIM Edit1 AS CONTROL
 DIM Check1 AS CONTROL
 DIM Label1 AS CONTROL
 DIM Radio1 AS CONTROL
 DIM Radio2 AS CONTROL
 DIM Combo1 AS CONTROL
 DIM List1 AS CONTROL
 DIM Rect1 AS CONTROL
 DIM Rect2 AS CONTROL
 DIM Rect3 AS CONTROL
 DIM Date1 AS CONTROL
 DIM Rich1 AS CONTROL
 DIM Stat1 AS CONTROL
 DIM Bitm1 AS CONTROL
 DIM Ico1 AS CONTROL
 DIM LView1 AS CONTROL
 DIM Buffer$
 DIM Rect AS RECT
 DIM HDCBmp AS HDC
 DIM retval
    
    
 SUB FORMLOAD()
   CALL LoadBuffer1()
   '*************************************************************************  
   Form1   = BCX_FORM("More Good Stuff!",               0,   0, 315, 260)
   Group1  = BCX_GROUP("Group",           Form1, 100,   2,   2, 128,  75)
   Edit1   = BCX_EDIT("BCX Edit Box",     Form1, 101,   5,  15,  72,  35)
   Button1 = BCX_BUTTON("Button 1",       Form1, 102,  85,  10,  40,  15)
   Button2 = BCX_BUTTON("Button 2",       Form1, 103,  85,  35,  40,  15)
   Check1  = BCX_CHECKBOX("Checkbox",     Form1, 104,   5,  60,  50,  15)
   Radio1  = BCX_RADIO("Radio 1",         Form1, 105,  65,  50,  60,  15)
   Radio2  = BCX_RADIO("Radio 2",         Form1, 106,  65,  60,  60,  15)
   Label1  = BCX_LABEL("This is a label", Form1, 107,   5,  50,  60,  10)
   Combo1  = BCX_COMBOBOX("",             Form1, 108, 135,   6,  73,  35)
   List1   = BCX_LISTBOX("",              Form1, 109, 210,   6,  73,  35)
   Date1   = BCX_DATEPICK("",             Form1, 110, 135,  55, 115,  10)
   Button3 = BCX_BUTTON("Capture BMP",    Form1, 118, 135,  70,  70,  15)
   Rect1   = BCX_BLACKRECT("",            Form1, 111, 135,  35,  10,  10)
   Rect2   = BCX_WHITERECT("",            Form1, 112, 155,  35,  10,  10)
   Rect3   = BCX_GRAYRECT("",             Form1, 113, 175,  35,  10,  10)
   Rich1   = BCX_RICHEDIT(Buffer$,        Form1, 114,   5,  90, 190, 150)
   Bitm1   = BCX_BITMAP("demo.bmp",       Form1, 115, 205, 175,   0,   0)
   Ico1    = BCX_ICON("demo.ani",         Form1, 116, 190,  32,   0,   0)
   LView1  = BCX_LISTVIEW("",             Form1, 117, 197,  90, 110, 100)
   Stat1   = BCX_STATUS("Ready",          Form1)
   '*******************************************************************************  
   SENDMESSAGE(Rich1, EM_SETBKGNDCOLOR, 0, 0) ' Set background to black  
   ListView_SetTextColor(LView1, RGB(0, 128, 0)) ' Set Listview text to green  
   CALL FakeData()                             ' Put some data into our controls  
   CENTER(Form1)                              ' Center it!  
   SHOW(Form1)                              ' Show it!  
 END SUB
    
 BEGIN EVENTS
   SELECT CASE CBMSG
     '**********************  
   CASE WM_SIZE
     '***********************  
     SENDMESSAGE(Stat1, CBMSG, CBWPARAM, CBLPARAM) ' Babysit the status bar  
     '**********************  
   CASE WM_COMMAND
     '**********************  
     IF CBCTL = 102 THEN
       CALL LoadBuffer1()
       SETWINDOWRTFTEXT(Rich1, Buffer$)
       SetWindowText(Stat1, "Button 1 Pressed")
       InvalidateRect(Form1, 0, 1)
       SHOW(Group1)
       SHOW(Button2)
       SHOW(Button3)
       SHOW(Edit1)
       SHOW(Check1)
       SHOW(Radio1)
       SHOW(Radio2)
       SHOW(Label1)
       SHOW(Combo1)
       SHOW(List1)
       SHOW(Date1)
       SHOW(Rect1)
       SHOW(Rect2)
       SHOW(Rect3)
       SHOW(Bitm1)
       SHOW(Ico1)
       SHOW(LView1)
     END IF
    
     IF CBCTL = 103 THEN
       CALL LoadBuffer2()
       SETWINDOWRTFTEXT(Rich1, Buffer$)
       SetWindowText(Stat1, "Button 2 Pressed")
       InvalidateRect(Form1, 0, 1)
       HIDE(Group1)
       HIDE(Button2)
       HIDE(Button3)
       HIDE(Edit1)
       HIDE(Check1)
       HIDE(Radio1)
       HIDE(Radio2)
       HIDE(Label1)
       HIDE(Combo1)
       HIDE(List1)
       HIDE(Date1)
       HIDE(Rect1)
       HIDE(Rect2)
       HIDE(Rect3)
       HIDE(Bitm1)
       HIDE(LView1)
       HIDE(Ico1)
     END IF
    
     IF CBCTL = 118 THEN
       ' Capture Client area of a window  
       GetClientRect(Rich1, &Rect)
       HDCBmp = GETBMP(Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, Rich1)
       ' Capture User defined area of a window  
       '     HDCBmp = GetBmp(113, 58, 143, 54, Rich1)  
       ' Capture User defined area of screen. NULL is HDC for screen  
       '     HDCBmp = GetBmp(0, 0, 300, 200, NULL)  
       SAVEBMP(HDCBmp,"richedit.bmp")
       ' IMPORTANT ! Release the device context resources back to the system.  
       retval = DeleteDC(HDCBmp)
       SHELL "start richedit.bmp" ' This should start PaintBrush on all systems  
     END IF
    
     EXIT FUNCTION
     '**********************  
   CASE WM_CTLCOLOREDIT
     '**********************  
     IF (CONTROL) lParam = Edit1 THEN
       FUNCTION = SetColor(RGB(0, 255, 0), RGB(0, 0, 0), CBWPARAM, CBLPARAM)
     END IF
     '**********************  
   CASE WM_CLOSE
     '**********************  
     IF MSGBOX("Are you sure?", "Quit Program!", MB_YESNO) = IDYES THEN
       DestroyWindow(Form1)
     END IF
     EXIT FUNCTION
   END SELECT
 END EVENTS
    
 SUB FakeData
   LOCAL i, A$, B$
    
   FOR i = 1 TO 100
     A$ = A$ & "Line number" & STR$(i) & CRLF$
   NEXT
    
   SetWindowText(Edit1, A$)
    
   FOR i = 97 TO 97 + 25
     A$ = "ListBox item " & UCASE$(CHR$(i))
     B$ = "ComboBox item " & UCASE$(CHR$(i))
     SENDMESSAGE(List1, LB_ADDSTRING, 0, A$)
     SENDMESSAGE(Combo1, CB_ADDSTRING, 0, B$)
   NEXT
    
   '==========================  
   LOCAL j, lvItem AS LV_ITEM
   '==========================  
   
   lvItem.mask = LVIF_TEXT
    
   WHILE DATA$[j] <> "EOD"
     lvItem.pszText   = DATA$[j]
     lvItem.iSubItem = 0
     ListView_InsertItem(LView1, &lvItem)
     INCR(j)
     lvItem.pszText  = DATA$[j]
     lvItem.iSubItem = 1
     ListView_SetItem(LView1, &lvItem)
     INCR(j)
     lvItem.pszText  = DATA$[j]
     lvItem.iSubItem = 2
     ListView_SetItem(LView1, &lvItem)
     INCR(j)
   WEND
    
   Set_ColumnText(LView1, 0, "First")
   Set_ColumnText(LView1, 1, "Last")
   Set_ColumnText(LView1, 2, "is on a")
    
   '=============================================  
   DATA "Woodrow" , "Wilson"   , "$100,000"
   DATA "James"   , "Madison"  , "$  5,000"
   DATA "Grover"  , "Cleveland" , "$  1,000"
   DATA "William" , "McKinley" , "$    500"
   DATA "Benjamin" , "Franklin" , "$    100"
   DATA "Ulysses" , "Grant"    , "$     50"
   DATA "Andrew"  , "Jackson"  , "$     20"
   DATA "Alexander", "Hamilton" , "$     10"
   DATA "Abraham" , "Lincoln"  , "$      5"
   DATA "Thomas"  , "Jefferson" , "$      2"
   DATA "George"  , "Washington", "$      1"
   DATA "---------", "----------", "-----------"
   DATA "Dwight"  , "Eisenhower", "Dollar"
   DATA "John"    , "Kennedy"  , "Half Dollar"
   DATA "George"  , "Washington", "Quarter"
   DATA "Franklin" , "Roosevelt" , "Dime"
   DATA "Thomas"  , "Jefferson" , "Nickle"
   DATA "Abraham" , "Lincoln"  , "Penny"
   DATA "EOD"
   '=============================================  
 END SUB
    
 FUNCTION SetColor (ByVal TxtColr, ByVal BkColr, ByVal wParam, ByVal lParam) AS LRESULT
   DIM STATIC ReUsableBrush AS HBRUSH
   '******s********************************************  
   IF ReUsableBrush THEN DeleteObject(ReUsableBrush)
   '**************************************************  
   ReUsableBrush = CreateSolidBrush(BkColr)
   SetTextColor((HDC)(UINT_PTR)wParam, TxtColr)
   SetBkColor  ((HDC)(UINT_PTR)wParam, BkColr)
   FUNCTION = (LRESULT)ReUsableBrush
 END FUNCTION
    
 SUB LoadBuffer1 ()
   Buffer$ = ""
   Buffer$ += "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl"
   Buffer$ += "{\f0\froman\fprq2\fcharset0 Times New Roman;}"
   Buffer$ += "{\f1\froman\fprq2\fcharset0 Tahoma;}"
   Buffer$ += "{\f2\fswiss\fprq2\fcharset0 Verdana;}}"
   Buffer$ += "{\colortbl ;\red255\green255\blue0;"
   Buffer$ += "\red0\green0\blue0;\red0\green255\blue255;"
   Buffer$ += "\red128\green128\blue128;\red255\green0\blue0;"
   Buffer$ += "\red0\green255\blue0;\red0\green0\blue255;"
   Buffer$ += "\red255\green255\blue255;}"
   Buffer$ += "\viewkind4\uc1\pard\qc\cf1\b\i\f0\"
   Buffer$ += "fs72 BCX RICHEDIT\cf2\f1\par"
   Buffer$ += "\cf3 Control\cf4\i0\f2\par"
   Buffer$ += "\cf5\ul\b0 D\cf6 E\cf7 M\cf1 O\cf4\ulnone\par"
   Buffer$ += "\par"
   Buffer$ += "\cf8\fs20 by MrBcx 2001\par"
   Buffer$ += "\par"
   Buffer$ += "\par"
   Buffer$ += " BCX homepage:\par"
   Buffer$ += "http://www.BcxBasicCoders.com \cf4\par"
   Buffer$ += "}"
 END SUB
    
 SUB LoadBuffer2 ()
   $FILL Buffer$
   "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl"
   "{\f0\fnil\fcharset0 Times New Roman;}}"
   "{\colortbl ;\red255\green255\blue0;"
   "\red0\green255\blue0;"
   "\red0\green0\blue255;}"
   "\viewkind4\uc1\pard\f0\fs20\par\par"
   "\par\par\par"
   "\cf1\fs96     S\cf2 u\cf1 r\cf2 p\cf1 r\cf2 i\cf1 s"
   "\cf2 e\cf3 !\cf0\fs20\par\par\par}"
   $FILL
 END SUB
    
 SUB Set_ColumnText (ByVal HndlWnd AS HWND, ByVal Column, ByVal Text$)
   LOCAL lvc AS LV_COLUMN
   lvc.mask = LVCF_TEXT
   lvc.pszText = Text$
   SENDMESSAGE(HndlWnd, LVM_SETCOLUMN, Column, &lvc)
 END SUB