' Dialog Events — Win32 window procedure pattern
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION MessageBox LIB "USER32.DLL" ALIAS "MessageBoxA" (BYVAL hWnd AS LONG, BYVAL lpText AS ASCIIZ, BYVAL lpCaption AS ASCIIZ, BYVAL uType AS LONG) AS LONG

FUNCTION PBMAIN() AS LONG
    LOCAL result AS LONG
    PRINT "Dialog Events via Win32:"
    result = MessageBox(0, "Button clicked!" + CHR$(0), "Event" + CHR$(0), 0)
    PRINT "MessageBox returned: " + STR$(result)
    FUNCTION = 0
END FUNCTION
