

  $ filename "t.exe"
  'uses RTL64
  $ EscapeKeyEnd
  uses WinUtil
  MainWindow 530,320,WS_OVERLAPPEDWINDOW


  % ID_FIRSTCHILD  100 


  sys hinstance
  sys hWndMain


  '  STANDARD CHILD WINDOWS STYLES
  '  =============================
  '  "Button"
  '  "ComboBox"
  '  "Edit"
  '  "ListBox"
  '  "MDIClient"
  '  "ScrollBar"
  '  "Static"




  dim cRect   as rect
  dim Paintst as paintstruct

  dim hDC     as sys


  function WndProc(sys hwnd, uMsg, wParam, lParam) as long callback
  '================================================================
  indexbase 0
  RECT rcClient; 
  sys i,w,px,py,lx,ly,nx,ny,id,idmenu,style
  static sys hchw[0x200] 
  string s,stys
 
  select umsg 
 
  case WM_CREATE
    idmenu=0
    '
    SetWindowText hwnd,"Button Controls"
    '
    i=0x100
    lx=50
    ly=50
    nx=0
    ny=0
    stys="button"
    style=WS_CHILD | BS_TEXT | BS_PUSHBOX | WS_VISIBLE
    '
    'Button Pad
    do
      i++
      px=10+nx*lx
      py=10+ny*ly
      id=i
      s=str id
      hchw[i]=CreateWindowEx(0,stys, s, style, px,py,lx-5,ly-5, hwnd, id, hinst, null)
      nx++
      if nx>=10 then
        ny++
        if ny>=5 then exit do 'complete x and y
        nx=0
      end if
    end do

    case WM_COMMAND

      id=wparam and 0xffff
      int co=wparam >>16
      if id>0x100 and id<0x200 then
        s="PushButton: " str id
        SetWindowText hWnd, s
        SetWindowText hchw[id], hex(id)+"h"
        SetFocus hwnd
      end if

    case WM_DESTROY: 
 
      PostQuitMessage 0 

    case else

      return DefWindowProc(hwnd, uMsg, wParam, lParam)

    end select
    '
  end function

 
