HOWTO: Set the Default Printer Programmatically in Windows 95, Windows 98, or Windows Me

Article translations Article translations
Article ID: 140560 - View products that this article applies to.
This article was previously published under Q140560
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

SUMMARY

To set the default printer programmatically under Windows 95, Windows 98, or Windows Millennium Edition (Me) use the SetPrinter() Win32 API function.

Note that the SetPrinter() API call is a valid method, but is platform-dependent and should work only on Windows 95, Windows 98, or Windows Me (it does not work on Windows NT or on a 16-bit platform).

MORE INFORMATION

To set or change the default printer under Windows 95, call:
SetPrinter(HANDLE hPrinter, DWORD dwLevel, LPBYTE lpbPrinter,
DWORD dwCommand)
				
Obtain the hPrinter parameter from OpenPrinter() as a handle that identifies the desired printer. Set the dwLevel parameter to 5, and point lpbPrinter to the PRINTER_INFO_5 structure. Set the dwCommand parameter to 0 (zero). Fill out the PRINTER_INFO_5 structure appropriately making sure that the Attributes field has PRINTER_ATTRIBUTE_DEFAULT set.

Properties

Article ID: 140560 - Last Review: February 28, 2014 - Revision: 2.3
APPLIES TO
  • Microsoft Windows 95 Driver Development Kit (DDK)
  • Microsoft Windows 98 Driver Development Kit (DDK)
  • Microsoft Windows Millennium Edition Driver Development Kit
Keywords: 
kbnosurvey kbarchive kbenv kbhowto KB140560

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com