StartDocPrinter (winspool)
Last changed: -62.227.250.230

.
Summary
TODO - a short description

C# Signature:

[DllImport("winspool.dll", SetLastError=true)]
static extern TODO StartDocPrinter(TODO);

VB Signature:

Declare Function StartDocPrinter Lib "winspool.dll" (TODO) As TODO

<DllImport("winspool.drv", EntryPoint:="StartDocPrinterA", ExactSpelling:=True, SetLastError:=True, CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)> _
Private Shared Function StartDocPrinter(ByVal hPrinter As IntPtr, ByVal level As Integer, ByRef pDocInfo As DOC_INFO_1) As Integer
End Function

This implementation of StartDocPrinter must be used with the ANSI version of DOC_INFO_1.

User-Defined Types:

DOC_INFO_1

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

StartDocPrinter returns a PrintJobIdentifier (integer value) and must not be declared Boolean!

According to MSDN the second parameter level must always be 1

Tips & Tricks:

Please add some!

Sample Code:

    Public Function StartDoc(hPrinter as IntPtr, ByVal documentTitle As String) As Boolean
        Dim di As New DOC_INFO_1
        With di
        .pDocName = documentTitle
        .pOutputFile = vbNullString
        .pDatatype = vbNullString
        End With
        printJobID = StartDocPrinter(hPrinter, 1, di)
        Return (printJobID <> 0)
    End Function

Documentation