Subj : Re: How to select a non-default printer? To : borland.public.cpp.borlandcpp From : "David Ayre" Date : Tue Jan 06 2004 08:06 am Hi Bob, Thanks for that. I want the programme to select one of the other printers installed instead of the default. The user won't know about this. By the way, do you know where this info is stored in Win 2000? In earlier versions it is in win.ini. Cheers, David Bob Gonder wrote: >David Ayre wrote: > >>I use a routine that automatically selects the default printer, >>But I would now like to be able to override the default selection >>and select another printer. > >You the User, or You the Programmer? >For You the User, remove sPd.Flags = PD_RETURNDEFAULT; > >For You the Programmer, you could use EnumPrinters with PRINTER_INFO_2 >to get the same data your are saving. > >> lpDevNames = (LPDEVNAMES)GlobalLock(sPd.hDevNames); >> lpcDriver = (LPSTR)lpDevNames + lpDevNames->wDriverOffset; >> lpcDevice = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset; >> lpcPort = (LPSTR)lpDevNames + lpDevNames->wOutputOffset; >> GlobalUnlock(sPd.hDevNames); >> ptr = (LPDEVMODE)GlobalLock(sPd.hDevMode); > > .