Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
Available now!
Buy at Amazon US or
Buy at Amazon UK



Articles

1.Windows API reference
2.HTML to WML Converter
3.Webcam streaming in VB.NET
4.Remoting with firewalls
5.RSA from first principles
6.Key & MouseLogger in .NET
7.Networking Resource Kit for .NET
8.Automatic Reboot with .NET
9.XAML Schema
10.Migrating VB6 Winsock to VB.NET
11.Migrating C++ sockets to C#
12.RFC Reference guide
13.Lingua - Localization webservice
14.COM Reference guide
15.WMI Reference guide
16.SQL stored procedures
17.TCP & UDP port reference
18..NET Framework reference
19.Ethernet Type codes
21.MAC address assignments
22.DLL entry point reference
23.WHOIS server list
24. Turing Numbers
25. Boost SQL performance
26. Progress Bar in ASP.NET
27. OleDb WebService
27. Internet Explorer

Contact us

EnumPrinters Reference in C#, VB.NET and VB6

Library:winspool.drv

Visual Basic 6 definition
Declare Function EnumPrinters Lib "winspool.drv" Alias "EnumPrintersA" (ByVal flags As Long, ByVal name As String, ByVal Level As Long, pPrinterEnum As Long, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long

Visual Basic .NET definition
Declare Function EnumPrinters Lib "winspool.drv" Alias "EnumPrintersA"(ByVal flags As Integer, ByVal name As String, ByVal Level As Integer, ByRef pPrinterEnum As Byte, ByVal cdBuf As Integer, ByRef pcbNeeded As Integer, ByRef pcReturned As Integer) As Integer

C# definition
[DllImport("winspool.drv", EntryPoint="EnumPrinters")] public static extern int EnumPrintersA(int flags, string name, int Level, ref byte pPrinterEnum, int cdBuf, ref int pcbNeeded, ref int pcReturned)

Description

Platforms: Win 95/98, Win NT EnumPrinters finds and returns information about one or more printers which the computer has access to. These include both local printers (physically connected to the machine) and network printers (accessible via the network). Under Win 95/98, the information can be passed in a PRINTER_INFO_1, PRINTER_INFO_2, or PRINTER_INFO_5 structure. Under Win NT, the information can be passed in a PRINTER_INFO_1, PRINTER_INFO_2, or PRINTER_INFO_4 structure. Note that structures 4 and 5 are the quickest ones to use. The attributes of the chosen structure determine what kinds of information about the printer(s) is returned. The information itself is put into the array passed as pPrinterEnum, which can then be copied into an array of data structures. The function returns 1 if successful, or 0 if an error occured. Note for Visual Basic users: Due to limitations in the Visual Basic language, it is impossible to pass an array of PRINTER_INFO_* structures as pPrinterEnum -- the array must be of Long-type elements. Also, for some reason the CopyMemory function cannot be used to successfully transfer the array information into the structure. Instead, each individual member of the data structure must be set manually. Look at the two examples for details how. In order to convert a Long-type string pointer (in the array) to a string, variants of the lstrcpy and lstrlen function must be used. Again, see the examples. CopyMemory, however, can be used to copy the data structures which make up parts of the PRINTER_INFO_2 data structure. EnumPrinters Enumerates available printers, print servers, domains, or print providers. System.Drawing.Printing.PrinterSettings.InstalledPrinters

Parameters

Further Information:

For further information on Windows API functions such as these, and how to use these API's in your C# and VB.NET applications, please refer to the book 'Network programming in .NET' (Buy at Amazon UK) (Buy at Amazon US)

Visual Basic 6 example source code

Visual Basic .NET example source code

C# example source code

Provide a code example

C#
VB.NET
VB6




Google

Copyright 2012 Open Merchant Account Ltd.
Free SMS UK Free SMS Ireland SMS Gratis Norway SMS Gratis Sverige Ilmainen SMS Suomi SMS Gratis Danmark SMS Tasuta Eestisse SMS Nemokamai Lietuva SMS Bezmaksas Latviju Darmowe smsy Polska SMS Zdarma Ceské SMS Zdarma Slovensko SMS Gratis Deutschland SMS Gratis Schweiz SMS Gratis Österreich SMS Gratuit Belgique SMS Gratis Nederland SMS Gratuit France SMS Gratis Espańa SMS Gratis Portugal Free SMS South Africa Free SMS USA SMS Percuma Malaysia Free SMS Hong Kong