Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default printer in correct case (proper)
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00645735
Message ID:
00645879
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
>>>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--
Previous
Reply
Map
View

Click here to load this message in the networking platform