PRB: PRINTER_INFO_2 Incorrectly Defined in Visual Basic API Text Viewer (201714)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API)
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q201714 SYMPTOMS
When you are using Win32 API functions that accept PRINTER_INFO_2 structures from Visual Basic, the API calls fail.
CAUSE
The Visual Basic API Text Viewer incorrectly defines two of the fields in the PRINTER_INFO_2 structure. Both the LPDEVMODE and the PSECURITY_DESCRIPTOR fields should be declared as Long rather than with their full structure definitions.
RESOLUTION
The following is the proper declaration of a PRINTER_INFO_2 structure in Visual Basic:
Public Type PRINTER_INFO_2
pServerName As String
pPrinterName As String
pShareName As String
pPortName As String
pDriverName As String
pComment As String
pLocation As String
pDevMode As Long ' LPDEVMODE
pSepFile As String
pPrintProcessor As String
pDatatype As String
pParameters As String
pSecurityDescriptor As Long ' PSECURITY_DESCRIPTOR
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
Status As Long
cJobs As Long
AveragePPM As Long
End Type
For most uses, both pDevMode and pSecurityDescriptor should be assigned a value of 0 (zero) to indicate that they are not being used.
Modification Type: | Minor | Last Reviewed: | 4/3/2006 |
---|
Keywords: | kbDSWGDI2003Swept kbGDI kbprb KB201714 |
---|
|