
How to change the default printer from VB
Quote:
>=>>
>=>> May seem like stupid question but, does anyone know of a simple way to
>=>>temporarily change the default printer from VB.
>=>
>=>vb3 OR vb4? In VB4, look for help under PRINTER object.
>=> ------------------------------------------------------------
>=> Andrew Retallack - Johannesburg, South Africa
>I'm trying to work-out the same thing in VB3.
In VB3 - Use something like
GetProfileString("WINDOWS", "DEVICE", "", cDevice, 127)
to get the current default printer (save it for later?). Then use
something like
WriteProfileString("WINDOWS", "DEVICE", cNew)
to change to a new printer. Also, tell any other apps running that
win.ini has changed using -
PostMessageByString(HWND_BROADCAST, WM_WININICHANGE, 0, "WINDOWS")
I hope this helps.
--