  ' -- windows gui test, halProment, 19-05-2024 --
  '
  take diverprom 
  
  '--------------------------------------------------------------------
  Function WinMain(pro inst, prevInst, asciiz*cmdline, sys show) as pro
  '====================================================================

  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax
  with wc
  .style = CS_HREDRAW or CS_VREDRAW
  .lpfnWndProc = @WndProc 
  .cbClsExtra =0
  .cbWndExtra =0    
  .hInstance =inst
  .hIcon=LoadIcon 0, IDI_APPLICATION
  .hCursor=LoadCursor 0,IDC_ARROW
  .hbrBackground = GetStockObject WHITE_BRUSH 
  .lpszMenuName = null
  .lpszClassName = strptr "Demo"
  end with
  pro r=RegisterClass (@wc)
 
  Wwd = 520 : Wht = 400
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
  '
  hwnd = CreateWindowEx 0,wc.lpszClassName,"HalProment Basic",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0
  if not hwnd
    mbox "Unable to create window"
    exit function
  end if
  '
  ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  pro bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend
  end Function

  dim as rect crect 

  '------------------------------------------------------------------
  function WndProc (pro hWnd, wMsg, wParam, lparam ) as pro callback
  '==================================================================

    static as pro hdc
    static as pstring txt
    static as PaintStruct Paintst
 
    '==========
    select wMsg
    '==========
        
      '--------------
      case WM_CREATE
      '=============
      GetClientRect hWnd,cRect

      '--------------  
      case WM_DESTROY
      '===============
          
      PostQuitMessage 0
        
      '------------
      case WM_PAINT
      '============

       GetClientRect  hWnd, cRect
       hDC=BeginPaint hWnd, Paintst
       SetBkColor   hdc,black 'yellow
       SetTextColor hdc,green 'red
       DrawText hDC,"Hello Animal World!",-1,cRect,%DT_SINGLELINE or %DT_CENTER or %DT_VCENTER 
       EndPaint hWnd,Paintst
       function = 1
 
      '--------------   
      case WM_KEYDOWN
      '==============

      '============            
      Select wParam
      '============

	Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select

      '--------        
      case else
      '========
          
        function=DefWindowProc hWnd,wMsg,wParam,lParam
        
    end select

  end function 

'  WinMain inst,0,cmdline,SW_NORMAL  '' both lines are working
   WinMain 1,0,1,SW_NORMAL