
'====================================================================
'' Dialog in DLL demo, modal dialog as main.
''
'' Building with -DLL will create the DLL and import library.
'====================================================================

#include "dialogs.bas"

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

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


    Case WM_COMMAND

      If loword(wParam) = 100 Then
        EndDialog( hDlg, null )
      End If

    Case WM_CLOSE

      EndDialog( hDlg, null )

  End Select

  Return 0

End Function

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

'' Pass in the parent HWND so the dialog will behave as
'' a normal modal dialog.
''
Sub ShowDialog( Byval parent_hwnd As HWND ) export

  Dim As LPDLGTEMPLATE lpdt

  Dialog( 1, 0, 0, 90, 62, "Dialog from DLL", lpdt, _
          WS_OVERLAPPEDWINDOW Or DS_CENTER )

  DefPushButton( 100, -1, 40, 40, 12, "Close" )

  CreateModalDialog( parent_hwnd, @DialogProc, 0, lpdt )

End Sub

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