>>>Hi everybody,
>>>
>>>Sorry, if this question was asked before (by my colleague). How can I obtain a default printer in the correct case, e.g. not
>>>HP LASERJET 4000 SERIES PCL 6
>>>
>>>but HP LaserJet 4000 Series PCL 6 ?
>>>
>>>Is there any Windows API function I can use for this purpose?
>>>
>>>Thanks a lot in advance.
>>
>>Check Thread #
592724 Message #
592959. :)
>>You can also use code from Message #
644762. Just remove UPPER() from the RETURN.
>
>Thanks, Sergey. Super! Works like a charm and exactly what I need.
I'm still not sure if it's reliable. I did more testing and found out that on my PC (WIN2K PRO) the name of the default printer (it's network printer) stored in Expr filed in the 'OUTPUT=" line not "DEVICE=". I would rather use your approch
FUNCTION GetDefaultPrinter()
LOCAL lnItem, laList[1]
lcDefaultPrinter = ""
= Aprinters(laList)
FOR lnItem = 1 TO ALEN(laList,1)
IF Upper( laList[lnItem ,1]) = Set("PRINTER", 3)
lcDefaultPrinter = laList[lnItem ,1]
EXIT
ENDIF
ENDFOR
RETURN lcDefaultPrinter
--sb--