PRINTER_INFO_2 (Structures)
Last changed: -193.109.238.134

.
Summary
Used by the EnumPrinters call in Winspool.

C# Definition:

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    public struct PRINTER_INFO_2
    {
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pServerName;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pPrinterName;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pShareName;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pPortName;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pDriverName;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pComment;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pLocation;
        public IntPtr pDevMode;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pSepFile;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pPrintProcessor;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pDatatype;
        [MarshalAs(UnmanagedType.LPTStr)]
        public string pParameters;
        public IntPtr pSecurityDescriptor;
        public uint Attributes; // See note below!
        public uint Priority;
        public uint DefaultPriority;
        public uint StartTime;
        public uint UntilTime;
        public uint Status;
        public uint cJobs;
        public uint AveragePPM;
    }

VB Definition:

    <StructLayout(LayoutKind.Sequential)> _
    Private Structure PRINTER_INFO_2

        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pServerName As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pPrinterName As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pShareName As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pPortName As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pDriverName As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pComment As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pLocation As String

        Public pDevMode As IntPtr

        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pSepFile As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pPrintProcessor As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pDatatype As String
        <MarshalAs(UnmanagedType.LPTStr)> _
        Public pParameters As String

        Public pSecurityDescriptor As IntPtr
        Public Attributes As Integer
        Public Priority As Integer
        Public DefaultPriority As Integer
        Public StartTime As Integer
        Public UntilTime As Integer
        Public Status As Integer
        Public cJobs As Integer
        Public AveragePPM As Integer

    End Structure

User-Defined Field Types:

None.

Notes:

Instead of the definition

public uint Attributes;

your can also use

public PRINTER_ATTRIBUTES Attributes;

See the PRINTER_ATTRIBUTES enum for more details.

If you only want to get or set the DEVMODE struct, you can use the PRINTER_INFO_9 struct instead.

Documentation