954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

change Printer And Fax Default Printer From VB6

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

AhmedAltigani
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

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

AhmedAltigani
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Please reread my post above...

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You