What is returned from the printer dialog or common dialog 
Author Message
 What is returned from the printer dialog or common dialog

I wish to perfrom a record update if printing was successful.  What do I
test for and how?

Thanks in advance.  Many thanks.

CM



Fri, 01 Jul 2005 22:13:44 GMT  
 What is returned from the printer dialog or common dialog
'SetJob Constants - parameter Command
Const JOB_CONTROL_PAUSE = 1
Const JOB_CONTROL_RESUME = 2
Const JOB_CONTROL_CANCEL = 3
Const JOB_CONTROL_RESTART = 4

'GetJob Constants - parameter Command
Const JOB_STATUS_PAUSED = &H1
Const JOB_STATUS_ERROR = &H2
Const JOB_STATUS_DELETING = &H4
Const JOB_STATUS_SPOOLING = &H8
Const JOB_STATUS_PRINTING = &H10
Const JOB_STATUS_OFFLINE = &H20
Const JOB_STATUS_PAPEROUT = &H40
Const JOB_STATUS_PRINTED = &H80

Const JOB_POSITION_UNSPECIFIED = 0

Type DOCINFO
        cbSize As Long          'size, in bytes, of the structure.
        lpszDocName As String   'document name
        lpszOutput As String    'an output file or NULL
End Type

'If the functions fails, the return value is less than or equal to zero.
'StartDoc - If the function succeeds, the return value is greater than zero.
' This value is the print job identifier for the document.

Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (ByVal hdc As Long,
lpdi As DOCINFO) As Long
Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function AbortDoc Lib "gdi32" (ByVal hdc As Long) As Long

Type JOB_INFO_1
        JobId As Long
        pPrinterName As String
        pMachineName As String
        pUserName As String
        pDocument As String
        pDatatype As String
        pStatus As String
        Status As Long
        Priority As Long
        Position As Long
        TotalPages As Long
        PagesPrinted As Long
        Submitted As SYSTEMTIME
End Type

  'hPrinter- Printer DC like GetDC(Printer.hWnd)
  'JobId   - Level - 0, 1, 2; when is 0 isn't necessary to specifie pJob
  'pJob    - an JOB_INFO_1 address; then JobId must be 1
  'Command - JOB_CONTROL_CANCEL, JOB_CONTROL_PAUSE,JOB_CONTROL_RESTART,
JOB_CONTROL_RESUME
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function SetJob Lib "winspool.drv" Alias "SetJobA" (ByVal hPrinter
As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal
Command As Long) As Long
  'cdBuf      - actual size of pJob
  'pcbNeeded  - [OUT] address of value that contains count of bytes
retrieved (or required) FROM pJob
  'OTHER      - like from SetJob
Declare Function GetJob Lib "winspool.drv" Alias "GetJobA" (ByVal hPrinter
As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf
As Long, pcbNeeded As Long) As Long

'procesing WM_SPOOLERSTATUS
'fwJobStatus = wParam;       // job-status flag
'cJobsLeft   = LOWORD(lParam); // number of jobs remaining

With API function GetJob you can test status of an submited job

   Dim jobID as Long

   CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
   CommonDialog1.ShowPrinter

   jobID = StartDoc(CommonDialog1.hDC, 0)
   if jobID > 0 then
        'Colect jobID from future verification with GetJob or SetJob
   else
        'Error;
   endif
    ' ... Printing
   EndDoc(CommonDialog1.hDC)
See MSDN October 2001 - Printing and Print Spooler Functions
If you want to submit me an reply remove ~~ in front to my mail address


Quote:
> I wish to perfrom a record update if printing was successful.  What do I
> test for and how?

> Thanks in advance.  Many thanks.

> CM



Mon, 04 Jul 2005 16:49:26 GMT  
 What is returned from the printer dialog or common dialog
Thank you -

This looks like what I need


Quote:
> 'SetJob Constants - parameter Command
> Const JOB_CONTROL_PAUSE = 1
> Const JOB_CONTROL_RESUME = 2
> Const JOB_CONTROL_CANCEL = 3
> Const JOB_CONTROL_RESTART = 4

> 'GetJob Constants - parameter Command
> Const JOB_STATUS_PAUSED = &H1
> Const JOB_STATUS_ERROR = &H2
> Const JOB_STATUS_DELETING = &H4
> Const JOB_STATUS_SPOOLING = &H8
> Const JOB_STATUS_PRINTING = &H10
> Const JOB_STATUS_OFFLINE = &H20
> Const JOB_STATUS_PAPEROUT = &H40
> Const JOB_STATUS_PRINTED = &H80

> Const JOB_POSITION_UNSPECIFIED = 0

> Type DOCINFO
>         cbSize As Long          'size, in bytes, of the structure.
>         lpszDocName As String   'document name
>         lpszOutput As String    'an output file or NULL
> End Type

> 'If the functions fails, the return value is less than or equal to zero.
> 'StartDoc - If the function succeeds, the return value is greater than
zero.
> ' This value is the print job identifier for the document.

> Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (ByVal hdc As
Long,
> lpdi As DOCINFO) As Long
> Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
> Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
> Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
> Declare Function AbortDoc Lib "gdi32" (ByVal hdc As Long) As Long

> Type JOB_INFO_1
>         JobId As Long
>         pPrinterName As String
>         pMachineName As String
>         pUserName As String
>         pDocument As String
>         pDatatype As String
>         pStatus As String
>         Status As Long
>         Priority As Long
>         Position As Long
>         TotalPages As Long
>         PagesPrinted As Long
>         Submitted As SYSTEMTIME
> End Type

>   'hPrinter- Printer DC like GetDC(Printer.hWnd)
>   'JobId   - Level - 0, 1, 2; when is 0 isn't necessary to specifie pJob
>   'pJob    - an JOB_INFO_1 address; then JobId must be 1
>   'Command - JOB_CONTROL_CANCEL, JOB_CONTROL_PAUSE,JOB_CONTROL_RESTART,
> JOB_CONTROL_RESUME
> Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
> Declare Function SetJob Lib "winspool.drv" Alias "SetJobA" (ByVal hPrinter
> As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal
> Command As Long) As Long
>   'cdBuf      - actual size of pJob
>   'pcbNeeded  - [OUT] address of value that contains count of bytes
> retrieved (or required) FROM pJob
>   'OTHER      - like from SetJob
> Declare Function GetJob Lib "winspool.drv" Alias "GetJobA" (ByVal hPrinter
> As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal
cdBuf
> As Long, pcbNeeded As Long) As Long

> 'procesing WM_SPOOLERSTATUS
> 'fwJobStatus = wParam;       // job-status flag
> 'cJobsLeft   = LOWORD(lParam); // number of jobs remaining

> With API function GetJob you can test status of an submited job

>    Dim jobID as Long

>    CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
>    CommonDialog1.ShowPrinter

>    jobID = StartDoc(CommonDialog1.hDC, 0)
>    if jobID > 0 then
>         'Colect jobID from future verification with GetJob or SetJob
>    else
>         'Error;
>    endif
>     ' ... Printing
>    EndDoc(CommonDialog1.hDC)
> See MSDN October 2001 - Printing and Print Spooler Functions
> If you want to submit me an reply remove ~~ in front to my mail address



> > I wish to perfrom a record update if printing was successful.  What do I
> > test for and how?

> > Thanks in advance.  Many thanks.

> > CM



Wed, 06 Jul 2005 13:43:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. What is returned from the printer dialog or common dialog

2. Try Again: How to change the printer in the Print Dialog of the Common Dialog

3. Common Dialog Problem - Printer Dialog Copies Property

4. not able to get printer from Common Printer Dialog

5. Using Printer common dialog changes default printer

6. Get Printer Name from Printer Common Dialog Control

7. Having problem with Common Dialog Font Dialog - Please Help

8. Question about the Common Dialog print dialog control

9. Common Dialog -> File Dialog

10. print dialog w/o common dialog

11. Centering a Open Dialog box using the Common dialog

12. Microsoft Common Dialog Control 6.0 Problem (Print Dialog)

 

 
Powered by phpBB® Forum Software