
'====================================================================
'' Full-screen dialog demo with no titlebar and no border,
'' modal dialog as main.
'====================================================================

#include "dialogs.bas"

'====================================================================

Function DialogProc( Byval hDlg As  HWND, _
                     Byval uMsg As UINT, _
                     Byval wParam As WPARAM, _
                     Byval lParam As LPARAM ) As Integer

  Dim As HWND hWndButton
  Dim As RECT rcDesktop, rcButton

  Select Case uMsg

    Case WM_INITDIALOG

      '' Size the dialog to fit the desktop window.

      GetWindowRect( GetDesktopwindow(), @rcDesktop )
      MoveWindow( hDlg, 0, 0, rcDesktop.right, _
                  rcDesktop.bottom, true )

      '' Center the button in the dialog.

      hWndButton = GetDlgItem( hDlg, IDCANCEL )
      GetWindowRect( hWndButton, @rcButton )
      MoveWindow( hWndButton, _
                  (rcDesktop.right - rcButton.right) \ 2, _
                  (rcDesktop.bottom - rcButton.bottom) \ 2, _
                  rcButton.right, rcButton.bottom, 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

'====================================================================

Dim As LPDLGTEMPLATE lpdt

'' The WS_POPUP style will create a dialog window
'' with no title bar and no border.

Dialog( 1, 0, 0, 0, 0, "", lpdt, WS_POPUP )

PushButton( IDCANCEL, 0, 0, 40, 12, "Close" )

CreateModalDialog( 0, @DialogProc, 0, lpdt )

'====================================================================
 