I have a Visual Basic 6.0 application that needs to recognise when the user changes the Windows default printer via the Control Panel.
Now when the application starts up, ‘Printer.DeviceName’ contains that default printer name…easy.
If you then change the Windows default printer via the control panel, your Visual Basic application won’t recognize the new default until it is restarted.
Is there any way to refresh the Visual Basic Printer object somehow, so your application can recognize the change?
There’s an easier way. When your application starts, just set the
Printerobject’sTrackDefaultproperty toTrue.When the
TrackDefaultproperty isTrue, thePrinterobject will track changes to the default printer made through the Control Panel automatically.