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!

Printing on a Mixed 98/XP Network 1

Status
Not open for further replies.

davewelsh

Programmer
Jun 26, 2001
71
CA
All my labels and forms have the printer information stored in them. This way, I just ask FoxPro to print and it knows where to print to automatically. This has worked up till now, when added an XP machine to the network. This XP computer prints everything to the default printer.

To get around this, I used the hack to remove the printer info from the forms and labels and I went into the program and did this each time I needed to print:

Code:
SET PRINTER TO NAME //computername/printername
REPORT FORM formname TO PRINTER NOCONSOLE
SET PRINTER TO DEFAULT

Now the XP machine works fine. The problem is you can't use "//computername/printername" with 95/98. If I try

Code:
SET PRINTER TO NAME windowsprintername
REPORT FORM formname TO PRINTER NOCONSOLE
SET PRINTER TO DEFAULT

then it works with 98 but not XP.

Do I need to have the same OS on all the computers, or does someone know a workaround?
 
I just had a thought. I'll implement it tomorow and see if it works. I thought I'd try:

Code:
ON ERROR DO Nothing()
SET PRINTER TO NAME //computername/printername
SET PRINTER TO NAME //windowsprintername
ON ERROR
REPORT FORM formname TO PRINTER NOCONSOLE
SET PRINTER TO

Any comments/suggestions?
 
HI
YOu can use OS() function to decide which version you are running and then use the code..
IF OS(3) = 5 && WIndows 2000
myCode
ENDIF
etc etc... ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
I'm not sure if XP works like NT, but 95 and 98 printer names are not case-sensitive whereas NT printer names are. Maybe the same holds true for XP(?) Also, you may need to enclose the name in quotes:

SET PRINTER TO NAME "//computername/printername"
-or-
SET PRINTER TO NAME "MyPrinter"

Dave S.
 
Thanks alot. I can now print on the XP computer and the server (98). Now the problem is the other networked 98 computers.

After removing the printer information from my labels and reports, I now have to use

Code:
SET PRINTER TO NAME windowsPrinterName
on 98

and

Code:
SET PRINTER TO NAME //Server/Printer
on XP

But,
Code:
SET PRINTER TO NAME windowsPrinterName
only seems to work for local printers. I checked the win.ini of a networked 98 computer (and I used APRINTERS()) and I see the list of "windowsPrinterName"s. On the networked 98 computers I can type
Code:
SET PRINTER TO NAME windowsPrinterName
and there's no problem, but once I actually try to print it says "error loading printer driver".
 
If I understand what you are trying to do correctly, you won't be able to print to a networked printer from your own pc unless first, the printer is set as shared by the pc the printer is connected to, and then establish a port to it as one of your "Printers". If you are running the app from that particular pc and are trying to print on it, the printer will already be defined and attached so you can just issue the normal SET PRINTER TO NAME whateveritis from the app.

Dave S.
 
The network printers are shared and they are set up as printers on the 98 machines. So I can print to them normally with Word or Excel, etc.

When the printer info was stored in the .frx and .lbx files, the 98 computers could print everything to the right printers. When I put the XP computer in, it would always print to the default printer. So I removed the printer info from the .frx and .lbx files and used a SET PRINTER TO command. Based on whether the computer was XP or 98 I used //server/printer or WindowsPrinterName (thx ramini).

The problem is: SET PRINTER TO NAME WindowsPrinterName, where WindowsPrinterName is valid for that computer as defined by win.ini AND APRINTERS(), does not work if WindowsPrinterName is a networked computer. (At least that's how it seems to me right now.)
 
I see. So if you use the following code:

pName = GETPRINTER()
WAIT WINDOW 'Selected: ' + pName TIMEOUT 5
SET PRINTER TO NAME (pName)

Does it still produce the 'Error loading printer driver'? If so, I guess I'm confused. There may be an issue with the definition of the driver or the driver itself. Can you try a different say, more generic type of printer driver? Like mybe a Laserjet IV or something?

Dave S.
 
Dave S.:

The three lines you gave don't create an error. It's the line after, which tells the computer to print, that causes "Error Loading Printer Driver". It says this if I choose any of the four networked printers.

When the printer info was compiled as part of label/report there was no error, so I don't think it's the drivers themselves. The printers are an HP LaserJet 4, and HP LaserJet IIISi, a Panasonix KX-P2023, and a Fujitsu DL 1150.
 
Here's something strange.

Code:
LABEL FORM labelName TO PRINTER PROMPT

will work (selecting a network printer), but

Code:
SET PRINTER TO NAME WindowsPrinterName
LABEL FORM labelName TO PRINTER 
SET PRINTER TO DEFAULT

gives an error on the second line. I am SURE WindowsPrinterName is a valid Windows printer name because I can get it with APRINTERS() and with GETPRINTER(). Does this help in finding the error?
 
Hi guys,

Just to give you another entry point to try.
Change the windows default printer during your print action, something like this:

lcDefaultPrinter = getWindowDefaultPrinter()
lcNewPrinter = getSpecificPrinter()
setWindowsDefaultPrinter(lcNewPrinter)
...do your printing here
setWindowsDefaultPrinter(lcDefaultPrinter)

You have to code the mentioned procedures specific to the OS, for example in Win95 you change the defaultprinter via the WIN.INI.

Just a thought?

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top