Microsoft KB Archive/140560

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 21:53, 16 July 2020 by X010 (talk | contribs) (1 revision imported: importing part 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

HOWTO: Set the Default Printer Programmatically in Windows 95

Q140560



The information in this article applies to:


  • Microsoft Win32 Device Driver Kit (DDK) Windows 95





SUMMARY

To set the default printer programmatically under Windows 95, 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 (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.

Additional query words:

Keywords : kbenv kbOSWin95 kbDSupport
Issue type : kbhowto
Technology : kbAudDeveloper kbWin95search kbWinDDKSearch kbWin32sSearch kbWin32DDK95 kbWin32DDKSearch


Last Reviewed: July 8, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.