|Windows with Delphi|
Windows API (94)
Windows Filesystem (229)
Windows Forms (527)
Windows Graphics (1092)
About this site
Links to us
Change the windows default printer
This article has not been rated yet. After reading, feel free to leave comments and rate it.
The following code changes the default printer. Attention - this is a systemwide change and will affect other applications. Since this is discouraged, do it only if you have a really good reason.
You don't like the formatting? Check out SourceCoder then!
Device: array [0..255] of Char;
Driver: array [0..255] of Char;
Port: array [0..255] of Char;
Printer.PrinterIndex := 1;
Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
WriteProfileString('windows', 'device', Device);
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, longint(@Device))
anonymous from United Kingdom