'====================================================================
' Simple modal dialog as main.
'====================================================================

$ filename "SimpleModal.exe"
'uses rtl32
'uses rtl64

'% review

uses dialogs

==============================================

'MAIN CODE
=============================================
 
'dim nCmdline as asciiz ptr, hInstance as sys
'&nCmdline = GetCommandLine
'hInstance = GetModuleHandle(NULL)


function DialogProc( sys hDlg, uint uMsg, sys wParam, lParam ) as int callback

  select case uMsg
  
    case WM_INITDIALOG
      return true

    case WM_COMMAND
      select case loword(wParam)
        case IDCANCEL
           EndDialog( hDlg, null )
      end select
      
    case WM_CLOSE
      EndDialog( hDlg, null )
                
  end select

  return 0
end function

sub winmain()

  Dialog( 0, 0, 200, 100, "Memory based modal dialog using OxygenBasic",
          WS_OVERLAPPEDWINDOW or DS_CENTER )
  PushButton( "Close" , IDCANCEL, 80, 70, 40, 12 )
  CreateModalDialog( null, @DialogProc, 0)
end sub

winmain()

