' XPRINT via Win32 DECLARE — printing with CreateDC, StartDoc, StartPage
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION CreateDC LIB "GDI32.DLL" ALIAS "CreateDCA" (BYVAL lpDriverName AS ASCIIZ, BYVAL lpDeviceName AS ASCIIZ, BYVAL lpOutput AS ASCIIZ, BYVAL lpInitData AS LONG) AS LONG
DECLARE FUNCTION DeleteDC LIB "GDI32.DLL" (BYVAL hDC AS LONG) AS LONG
DECLARE FUNCTION StartDoc LIB "GDI32.DLL" ALIAS "StartDocA" (BYVAL hDC AS LONG, BYREF lpDoc AS LongPtr) AS LONG
DECLARE FUNCTION StartPage LIB "GDI32.DLL" (BYVAL hDC AS LONG) AS LONG
DECLARE FUNCTION EndPage LIB "GDI32.DLL" (BYVAL hDC AS LONG) AS LONG
DECLARE FUNCTION EndDoc LIB "GDI32.DLL" (BYVAL hDC AS LONG) AS LONG

FUNCTION PBMAIN() AS LONG
    PRINT "XPRINT via Win32 GDI Print API:"
    PRINT "1. CreateDC('WINSPOOL', printer, NULL, NULL)"
    PRINT "2. StartDoc(hDC, docinfo)"
    PRINT "3. StartPage(hDC)"
    PRINT "4. GDI drawing (TextOut, LineTo, etc.)"
    PRINT "5. EndPage(hDC)"
    PRINT "6. EndDoc(hDC) + DeleteDC(hDC)"
    FUNCTION = 0
END FUNCTION
