CONST PD_CURRENTPAGE
= &H00400000 CONST PD_DISABLEPRINTTOFILE
= &H00080000 CONST PD_RETURNDC
= &H00000100 CONST PD_RETURNDEFAULT
= &H00000400 CONST PD_USEDEVMODECOPIESANDCOLLATE
= &H00040000 CONST START_PAGE_GENERAL
= -1 CONST PD_RESULT_CANCEL
= 0 CONST PD_RESULT_PRINT
= 1 CONST PD_RESULT_APPLY
= 2
' CONST E_HANDLE = &H80070006
' http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=10886.msg91583#msg91583
' union {
' struct { comment either the following 8 lines
' };
' struct { or the following 3 lines
' dmPosition AS POINTL
' dmDisplayOrientation AS _UNSIGNED LONG
' dmDisplayFixedOutput AS _UNSIGNED LONG
' };
' };
' union { comment exactly 1 of the following 2 lines
' dmDisplayFlags AS _UNSIGNED LONG
' };
DIM pageranges
(0 TO 7) AS PRINTPAGERANGE
_DELAY .5 ' race condition for the window's appearance. t
= "qb64 prn test" + STR$(TIMER) 'random title for FindWindowA_TITLE "Whatever you actually want the title to be"
pde.lStructSize
= LEN(pde
)pde.hwndOwner = hWnd
pde.hDevMode = 0
pde.hDevNames = 0
pde.Flags
= PD_ALLPAGES
OR PD_RETURNDC
OR PD_USEDEVMODECOPIESANDCOLLATE
pde.Flags2 = 0
pde.nPageRanges = 0
pde.nMaxPageRanges
= 1 + UBOUND(pageranges
)pde.lpPageRanges
= _OFFSET(pageranges
(0))pde.nMinPage = 1
pde.nMaxPage = 1
pde.nCopies = 1
pde.hInstance = 0
pde.lpCallback = 0
pde.nPropertyPages = 0
pde.lphPropertyPages = 0
pde.nStartPage = START_PAGE_GENERAL
pde.dwResultAction = 0
IF PD_RESULT_PRINT
= pde.dwResultAction
THEN t1
= "qb64 prn test" + CHR$(0) ' fixed len str so it won't move doc.lpszOutput = 0
doc.lpszDatatype = 0
doc.fwType = 0
IF GDI_ERROR
= SetTextAlign
(pde.hDC
, GetTextAlign
(pde.hDC
) OR TA_UPDATECP
) THEN PRINT "GDI error" t = "Hello, world!"
SUB readDevMode
(t
AS DEVMODEA
) ' etc...
SUB readDevNames
(t
AS DEVNAMES
)
'PRINT peekstr(_OFFSET(t) + t.wDriverOffset)
'PRINT peekstr(_OFFSET(t) + t.wDeviceOffset)
'PRINT peekstr(_OFFSET(t) + t.wOutputOffset)