' Modeless Dialog — message loop via Win32 DECLARE
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION CreateWindowEx LIB "USER32.DLL" ALIAS "CreateWindowExA" (BYVAL dwExStyle AS LONG, BYVAL lpClassName AS ASCIIZ, BYVAL lpWindowName AS ASCIIZ, BYVAL dwStyle AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL nWidth AS LONG, BYVAL nHeight AS LONG, BYVAL hWndParent AS LONG, BYVAL hMenu AS LONG, BYVAL hInstance AS LONG, BYVAL lpParam AS LONG) AS LONG
DECLARE FUNCTION GetMessage LIB "USER32.DLL" ALIAS "GetMessageA" (BYREF lpMsg AS LongPtr, BYVAL hWnd AS LONG, BYVAL wMsgFilterMin AS LONG, BYVAL wMsgFilterMax AS LONG) AS LONG

FUNCTION PBMAIN() AS LONG
    PRINT "Modeless Dialog via Win32:"
    PRINT "1. CreateWindowEx to create dialog window"
    PRINT "2. GetMessage/DispatchMessage in a loop"
    PRINT "3. DestroyWindow to close"
    PRINT "See Win32 CreateWindowEx documentation"
    FUNCTION = 0
END FUNCTION
