Preciso obter o Status da impressão com a rotina abaixo.
não consigo faze-la funcionar.
alguem pode me ajudar ?
Grato,
#include "fivewin.ch"
#include "StrucT.ch"
#define PRINTER_ACCESS_ADMINISTER 0x00000004
STRUCT oPrnDefaults
MEMBER pDatatype AS LPSTR
MEMBER pDevMode AS LPSTR // LPDEVMODE
MEMBER DesiredAccess AS DWORD // ACCESS_MASK
MEMBER pFirstJob AS DWORD
MEMBER pNoJobs AS DWORD
MEMBER pLevel AS DWORD
MEMBER pJob AS DWORD // LPBYTE
MEMBER pcbBuf AS DWORD
MEMBER pcbNeeded AS DWORD // LPDWORD
MEMBER pcReturned AS DWORD //BOOL // LPDWORD
ENDSTRUCT
oPrnDefaults:DesiredAccess = PRINTER_ACCESS_ADMINISTER
If OpenPrinter(cPrinter , @hDC , oPrnDefaults:cBuffer )
If hDC # 0
oPrnDefaults:pFirstJob :=0
oPrnDefaults:pNoJobs :=100
oPrnDefaults:pLevel :=1
oPrnDefaults:pcbBuf :=0
********************************************************************
Result = EnumJobs(cPrinter, oPrnDefaults:pFirstJob ,;
oPrnDefaults:pNoJobs ,;
oPrnDefaults:pLevel ,;
oPrnDefaults:pJob ,;
oPrnDefaults:pcbBuf ,;
oPrnDefaults:pcbNeeded ,;
oPrnDefaults:pcReturned )
********************************************************************
msginfo( tostring( Result ) , "rESULT" )
msginfo( tostring(oPrnDefaults:pFirstJob ) , "Abrindo oPrnDefaults:pFirstJob " )
msginfo( tostring(oPrnDefaults:pNoJobs ) , "Abrindo oPrnDefaults:pNoJobs " )
msginfo( tostring(oPrnDefaults:pLevel ) , "Abrindo oPrnDefaults:pLevel " )
msginfo( tostring(oPrnDefaults:pJob ) , "Abrindo oPrnDefaults:pJob " )
msginfo( tostring(oPrnDefaults:pcbBuf ) , "Abrindo oPrnDefaults:pcbBuf " )
msginfo( tostring(oPrnDefaults:pcbNeeded ) , "Abrindo oPrnDefaults:pcbNeeded " )
msginfo( tostring(oPrnDefaults:pcReturned ) , "Abrindo oPrnDefaults:pcReturned " )
ClosePrinter( hDC )
else
// msginfo("não passando hDC # 0 " )
RETURN .F.
Endif
else
// msginfo("openprinter " )
RETURN .F.
Endif
//------------------------------------------------------------------------//
DLL32 FUNCTION OpenPrinter( pName AS LPSTR, @pPrinter AS LONG, pDef AS LPSTR ) ;
AS BOOL PASCAL ;
FROM "OpenPrinterA" LIB "winspool.drv"
//------------------------------------------------------------------------//
DLL32 FUNCTION EnumJobs( hPrinter AS LPSTR , FirstJob AS DWORD,;
NoJobs AS DWORD , Level AS DWORD,;
@pJob AS LPSTR , cbBuf AS DWORD,;
@pcbNeeded AS DWORD , @pcReturned AS DWORD ) ;
AS LONG PASCAL ;
FROM "EnumJobsA" LIB "winspool.drv"
//------------------------------------------------------------------------//
/*
BOOL EnumJobs(
__in HANDLE hPrinter,
__in DWORD FirstJob,
__in DWORD NoJobs,
__in DWORD Level,
__out LPBYTE pJob,
__in DWORD cbBuf,
__out LPDWORD pcbNeeded,
__out LPDWORD pcReturned
);
*/