Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Change the Default Printer Via Code

Status
Not open for further replies.

fotojock

Programmer
Jun 1, 2000
9
US
I have a Foxpro Win program on my network that prints to a label printer.&nbsp;&nbsp;Each time a job is sent to that printer, a page eject occurs on my Windows DEFAULT printer.&nbsp;&nbsp;I've tried everything to eliminate the eject, but to no avail.<br><br>I wonder if there's a command I could call (or some value I could modify) from inside my program to automatically change the Windows default printer on the fly (invisibly to my operators).&nbsp;&nbsp;If I could, I would switch the default to a dummy printer (LPT3), print my labels, then switch it back, in hopes of eliminating that pesky page eject.&nbsp;&nbsp;Must I modify WIN.INI or some other file on the fly or is there a command that switches the default printer?
 
WIN.INI contains info for the default printer, but I don't think changing that value on the fly will work.&nbsp;&nbsp;I believe any changes in WIN.INI (or SYSTEM.INI) would require a Windows restart to go into effect.
 
Does this extra page ejecting happen with all jobs sent to the printer by other programs? or just Foxpro?&nbsp;&nbsp;If it's just with Foxpro then it's probably in the Foxpro coding.<br><br>Did you try to change the SPOOL settings?&nbsp;&nbsp;ex: from EMF to RAW or DISABLE BI-DIRECTIONAL SUPPORT FOR THIS PRINTER instead of enabling it or START PRINTING AFTER LAST PAGE?<br><br>Did you check the printer's DETAILS tab and checked out the page seperator?<br> <p> <br><a href=mailto: > </a><br><a href= > </a><br>If a tree falls in the forest and there's no one around, does it make sound? Its not the sound that matters, but the silence it leaves behind.
 
What Network Operating System do you have?<br>If that is Novell Netware and you are using Clients for Netware (Netware`s clients , of course) as a default starting session, there is an option in login script that enables/disables some functions related with printer, such as printing a banner, add an extra page and a carriage return. Check that.<br>
 
Thanks for the tips, but still no answer yet.&nbsp;&nbsp;I've tried different settings for SPOOL and Novell, but no help.&nbsp;&nbsp;It does only happen in my Foxpro printer calls when I'm bypassing the Windows driver and either printing directly to LPT1 or doing a Novell CAPTURE to print on a network printer as if it were LPT1.&nbsp;&nbsp;The problem doesn't exist when I use a Windows driver, but for this project, the driver won't do the job, so I'm stuck with my page eject, it seems.&nbsp;&nbsp;Since it happens when writing directly to LPT1, that leaves Novell off the hook, I think.&nbsp;&nbsp;Foxpro must be causing this behind the code somewhere since I have no code that addresses the default printer in my routine.&nbsp;&nbsp;Guess this is what I get for using old DOS commands from within a Windows program . . . just too confusing for Foxpro & Windows to handle.<br><br>Think you're right about WIN.INI changes needing a reboot to take effect.&nbsp;&nbsp;That would have been an easy solution.&nbsp;&nbsp;This is not the first time that I've wished for a &quot;change the default printer&quot; command, but maybe it's just not possible.
 
I have read you have a Novell network system. Are you using Netware Clients on your Pc?? If so I have notice that exist an option that always adds and extra page (first page) when we want to print, this is the ´banner´. In this page is include some information, as well as user name who sends the job and a little more data. Is this kind of page you see on your printer??. If so disable it. If isnt I noticed that some printers had a ´internal link´ with others applications that results in tasks that we dont want, such as: registering software, some limitations, etc. What kind of printer do you have??<br>
 
It's not the banner page.&nbsp;&nbsp;I've tested this with the Novell Network off and am piping codes directly to a specialized label printer on LPT1 (from within a Foxpro Windows program).&nbsp;&nbsp;The Windows &quot;default&quot; printer (a laser) still prints a blank page even under this situation.&nbsp;&nbsp;I think Foxpro and Windows have gotten confused with my unusual printing technique.&nbsp;&nbsp;So I've decided the blank page is a problem I can live with, however I now have a new problem with printer errors (printer offline, etc) causing a GDF with my Foxpro program.&nbsp;&nbsp;So it seems I'm off to the Foxpro Forum for a different solution.&nbsp;&nbsp;Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top