Fernando,
MANY!!! thanks for confirming that I'm not the only one! :-)
As I've been Googling/reading since I posted this message earlier, I did
find the Registry entry that stores the default printer setting...
HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows\Device
at least for Win7 Pro...YMMV.
By clearing the Device value, the Windows default printer is "nulled"
and the 1958 error is triggered in VFP 9 SP2.
I also, by the way, found many posts online where MSoft
"representatives" and know-alots stated emphatically that you can not,
do not ever want to, and should not, try to set the "default printer" to
"none" for a lot of reasons. Sure, okay, great. But not even for
software development??? Ah well.
I think I now have everything I need to deal with this since getting a
list of installed printer names is simple, detecting the problem is a
no-brainer, and involving the end user in the process (at least once) is
probably necessary. But, I predict I'll get tech support contacts saying
"...but I don't know what printer to pick!?" Oye...
But if anyone has an opinion/advice on how to BETTER handle this
situation, I'm open!
Thanks again Fernando! Windows makes life challenging!
Mike Copeland
Fernando D. Bozzo wrote:
Hi Mike :
Last year and some years back I've been having this problem in citrix
environment, and with the same symptoms, no default printer in the last
case and printers being attached to the user session in background, but
after the application was started up.
In both cases the final solution was forcing a default printer and making
sure that it is attached before the application is loaded.
I've read a lot of forums because of this problems when they occurred, and
one of the problems commented (and happened to me too) is that sometimes
VFP don't get right the printer info or the default printer (I've got some
errors when querying with set("printer", 1/2), and one of the proposed
solutions was querying using Windows api and seting the default windows
printer using, too, win32 api.
In same cases even printer errors can't be get caught.
I don't have to hand links to give you because I'm answering from my phone.
Best regards!
El 9/10/2015 9:37 p. m., "Mike Copeland" <[email protected]> escribió:
Any and all,
Here's the scenario:
Problem: VFP 9 SP2 throws random errors "#1958 Error loading printer
driver"
Platform: Windows 7 Pro (x 150 workstations)
Printers: 99% Lexmark, various models, a couple HP for good measure (none
of the HP have been involved, yet)
Known trigger: the code line in my app "set printer to default"
Known fix: Manually reset the default printer in Windows 7
My application was last updated in December of 2014. Since then, no
changes.
Prior to last Saturday, no problems of this type.
Literally, "suddenly" last Saturday morning, 10/3/15, I began receiving 5
or 6 error reports per hour (my app emails me when it has an error) from
various locations (there are three physical buildings in three cities
running the same app.) All the errors were the same "Error loading printer
driver". The error is thrown when you try to print and the line "set
printer to default" is encountered. After the error, nothing is printed. No
error, prints fine.
It's not the data source: printing from ANY source (including not my
application) throws a printing error of some sort.
"The fix":
Rebooting always works...but I'm not a fan of this nuclear option, and the
problem has recurred on the same machine multiple times per day. Kind of a
work-killer to want to print a sales order for a waiting customer and have
to reboot first.
I discovered that manually setting the default printer in the Win7
"Devices and Printers" dialog fixes the problem.
I also found a WScript code snippet that will set the default printer, as
long as you know the printer's name.
"The obstacle":
I can't find a way to "un-set" the default printer in Win7 Pro for
trouble-shooting and code testing. Setting the default printer...no
problem...lots of solutions including code strings and utilities. But to
test my "fix" I need to be able to remove the default printer
selection/setting in Windows and after an hour of Googling, no luck finding
a way, whether by VFP or WScript or any other way in Windows.
Obviously something is removing the default printer setting.
So far only about 9 of the 150 systems have had this happen, but each day
is like Whack-a-Mole...a new system that hasn't done this before will start
throwing errors. When that happens I check the system, "no default printer"
is set, so I set it manually and the errors go away.
All the computers are cookie-cutter systems I built using the same
hardware/software. None of them allow the user to install software or
printers without an admin password that only I and the owner of the
business has. The hardware/software is as homogenous as
possible...personalization is frowned on and discouraged.
After finding a post from a few years ago on this list from Matt, I had
hopes that reinstalling the printer drivers would help. And it does, for a
while (because installing a printer driver sets the default printer) but
one workstation in particular has had two different printer drivers
installed, then subsequently lost the "default printer setting" and resumed
throwing errors.
My best solution so far:
When the 1958 error is trapped in my error routine, I can get a list of
installed printers to present in a popup for selection by the user, then
set that printer as the default....then print. That's doable, but I'd like
to bypass it.
Ideas already shot down as unacceptable by the end users:
ALWAYS prompt them to pick the printer. Oh no no no...
The workstations are physically arranged in clusters so that 3 to 6
workstations share a common, networked printer. ALL printers are networked,
none are physically connected to the workstation. The users never want to
print from "Workstation 12" to "Printer 5" which is physically distant
because that would require walking when they don't want to walk.
Any other ideas? Sorry this is long, but this is the results after a week
of research and troubleshooting.
What I would like to find out:
How to "unset" the default printer setting in Win7 Pro.
How to best automate the fix for the 1958 error so that the end user is
not forced to pick the default printer every time? I can store the default
printer name on that workstation (like in an INI file) and "if
file('printerdefault.ini')" read the setting and set it...
All of this is hard to do when I can't reproduce the error!
Thanks VERY much for any input! I also am posting this in the hopes that
someone else benefits from my troubleshooting someday...
Mike Copeland
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.