Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing Problems
Message
From
25/03/2000 19:02:49
 
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00350414
Message ID:
00350451
Views:
25
>>Using VFP6 get error "trouble loading driver" using a HP2100 laser printer. Report prints OK if the HP2100 is the default printer anywhere on the LAN. If is not you get the error. How can this proble be solved? what drivers should I use?
>
>As I remember, the 2100 is one of the WinGDI model printers, correct - it relies on the WinGDI directly to handle its graphic rendering, rather than the printer having its own rendering engine? If this is the case, I think you'll be forced to make it the default Windows printer before accessing it, because the GDI must step in and directly control the output process, regardless of whether the printer belongs to it, or to anther system.
>
>If this is the case, there's a straightforward workaround available to you - the WSH Wscript.Network object for WSH 2.0 and later has a SetDefaultPrinter method available to it that can assign either a remote printer or a local device to the status of the local Windows Default printer. It requires that you have the printer driver explicitly installed on each target workstation that relies on the 2100 so that the workstation has the knowledge of how the GDI must behave to directly drive the printer; it's definitely the case with one other HP printer that runs as a WinGDI printer, the HP 1100. As long as the driver for the 1100 has been installed properly on the local workstation previously, the following code snippet has worked for me to permit access to an 1100 shared via MS Networking through VFP:
>
>
* WSH 2.0 or later must be previously installed
>oWshNet = CREATEOBJECT('Wscript.Network')
>*  Force the local port LPT3: to be freed for reassignment, but don't change
>*  the default user profile information.  Free the port even if not in use.
>*  If the printer is attached to a local port already, this and the following
>*  step are unnecessary, just the SetDefaultPrinter is needed.
>oWshNet.RemovePrinterConnection('LPT3',.t.,.f.)
>*  Attach the remote printer to the local port, and do not alter the user
>*  profile to set this mapping as a part of the user's login process.  If
>*  needed, you can add a user name and password to attach the share if the
>*  default Windows login, or the domain login authenticated by the PDC, will
>*  not grant access to the printer.  You can substitute a call to
>*  AddWindowsPrinterConnection, under WinNT/Win2K, it will install the driver
>*  for a remote printer on the system if the driver is made available by the
>*  remote printer's owner;  Win9x requires that the driver has previously been
>*  installed even if the driver is provided by the remote printer's owner.
>*  AddWindowsPrinterConnection lets you make a printer connection without having
>*  explicitly assigned it to a port, which would obviate the preceding call to
>*  RemovePrinterConnection, but always requires Win9x to explicitly name the
>*  printer driver to use, so this sequence simplifies life if the printer driver
>*  has been explicitly installed to the system previously.
>oWshNet.AddPrinterConnection('LPT3','<i>NetBIOSName\PrintShareName</i>',.f.)

Correction - the preceding line needs to include the \\ in the server name prefix:

oWshNet.AddPrinterConnection('LPT3','\\<i>NetBIOSName\PrintShareName</i>',.f.)


>*  Force the named port to be assigned as the default Windows printer;  if you
>*  used AddWindowsPrinterConnection, reference the share name;  if it's a local
>*  printer, reference the right port.  Note that USB-attached printers may have
>*  unusual or unfamiliar port names if you aren't familiar with USB device
>*  naming;  check the printer properties if you are not sure.
>oWshNet.SetDefaultPrinter('LPT3')
>
>There may be other ways of doing this; it's the only one I've found that works with the WinGDI printers inside of VFP directly.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform