#include "windows.bi"

  function WndProc ( byval hWnd as HWND, _
                   byval wMsg as UINT, _
                   byval wParam as WPARAM, _
                   byval lParam as LPARAM ) as LRESULT
    
    function = DefWindowProc( hWnd, wMsg, wParam, lParam )    
    
  end function
  #include "windows.bi"
  #undef name
  #undef width
  #define makestring(s) #s
  sub gui_xml()

  dim as HINSTANCE hInstance = GetModuleHandle( null )
  dim as integer iCmdShow = SW_NORMAL
  dim wcls as WNDCLASS  
  
  with wcls
    	.style         = CS_HREDRAW or CS_VREDRAW
    	.lpfnWndProc   = @WndProc
    	.cbClsExtra    = 0
    	.cbWndExtra    = 0
    	.hInstance     = hInstance
    	.hIcon         = LoadIcon( NULL, IDI_APPLICATION )
    	.hCursor       = LoadCursor( NULL, IDC_ARROW )
    	.hbrBackground = CreateSolidBrush(bgr(240,240,240))
    	.lpszMenuName  = NULL
    	.lpszClassName = @"Window"
  end with
          
  if( RegisterClass( @wcls ) = FALSE ) then
    MessageBox( null, "Failed to register wcls", "Error", MB_ICONERROR )
    end
  end if

  
#define name Window1
#define titel "Fenstertitel"
#define x 148
#define y 145
#define width 213
#define height 233
#define Parent 
dim as HWND name = CreateWindowEx( 0, _
                           @"Window", _
                           titel, _
                           WS_OVERLAPPEDWINDOW, _
                           x, _
                           y, _
                           width, _
                           height, _
                           NULL, _
                           NULL, _
                           hInstance, _
                           NULL )
                          

    ShowWindow( name, iCmdShow )
    UpdateWindow( name )
  
#undef name
#undef titel
#undef x
#undef y
#undef width
#undef height
#undef Parent

  dim wMsg as MSG
  while( GetMessage( @wMsg, NULL, 0, 0 ) <> FALSE )    
    TranslateMessage( @wMsg )
    DispatchMessage( @wMsg )
  wend
  
end sub
