'==============================================================================
' DDT basics sample
' Creates a dialog and a button, prints the dialog/control handles,
' then ends without running a message loop.
'==============================================================================
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL hDlg   AS DWORD
    LOCAL hCtrl  AS DWORD
    LOCAL hWndDlg AS DWORD
    LOCAL hWndCtrl AS DWORD

    ' Create the parent dialog (0 = no owner window)
    DIALOG NEW 0, "DDT Basics", 10, 10, 300, 200 TO hDlg
    PRINT "DLG=" + STR$(hDlg)

    ' Add a button control
    CONTROL ADD BUTTON, hDlg, 100, "OK", 10, 10, 80, 24 TO hCtrl
    PRINT "CTRL=" + STR$(hCtrl)

    ' Expose the underlying HWND values for SDK interop
    DIALOG GET HANDLE hDlg TO hWndDlg
    CONTROL GET HANDLE hDlg, 100 TO hWndCtrl
    PRINT "HWND_DLG=" + STR$(hWndDlg)
    PRINT "HWND_CTRL=" + STR$(hWndCtrl)

    DIALOG END hDlg
    FUNCTION = 0
END FUNCTION
