Please if any one knows how to change the default printer on control pannel-printer and fax permenantly, means when I go out from My VB6 program the default printer I set still as default one.

Thanks and best regards

Recommended Answers

All 3 Replies

Using the common dialog control with the flag of defaultprinter=true is one way. The other is the API...

http://vbnet.mvps.org/index.html?code/system/defaultprinter.htm

http://www.tek-tips.com/faqs.cfm?fid=5479

However, the API seems a bit outdated but checking with MS...

http://support.microsoft.com/kb/266767
http://support.microsoft.com/kb/246772/EN-US/

With Windows NT 4.0 (and earlier versions), you cannot use:
Either SetPrinter or SetDefaultPrinter to set the default printer.
Either EnumPrinters or GetDefaultPrinter to get the default printer.
With Windows NT 4.0, you can use:
GetProfileString to get the default printer.
WriteProfileString to set the default printer.

So, you will need to check for the os to see if it is NT or earlier or Win2k or later to see which set of API's to use.

Good Luck

I donn't want to use Commmon Dialog, becasue I am printer using DataReport, Is ther any way to change the default printer before dumping to DataReport just once, and keep this default for other printing in the application. Thanks

Please reread my post above...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.