Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PrtInfo() causing fatal error -> Fix
Message
From
02/06/2005 09:51:21
 
 
To
31/05/2005 17:57:11
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01018857
Message ID:
01019356
Views:
18
There is a known bug with prtinfo() where it will intermittently cause a fatal exception when the 2nd parameter (cPrinterName) is specified. This is fixed in VFP 9. We haven't tested in VFP 6, but we have reproduced it in VFP 7 and VFP 8.

Assuming this is the problem you are seeing, as a workaround you can append a chr(0) to the cPrinterName parameter like this:
cPrinter = <printer name>
lnPrinterPaperSize = prtinfo(2, AllTrim(cPrinter)+chr(0))
The fatal exception occurs when a null termination for the string is not found. Calling SYS(1104) may help ensure that a null termination is found before looking outside of VFP's address space, which causes the crash.

>hello everybody.
>
>This is a quick-fix/workaround for a problem i've encountered for a while now.
>
>i have a extensive printer selection gui (like ms word has), in which the PrtInfo() function is called several times with different parameters. each time the user chooses a different printer, those functions are called again.
>
>on a semi-consistent base i would get a fatal error - always on the PrtInfo() command. never found a solution for this, untill i tried an idea i just got - issue sys(1104) right before each PrtInfo() call.
>
>it seem so far that this has solved my error problem. so for anyone who also got this fatal error - try "sys(1104)" right before the PrtInfo() function.
>
>hope this helps someone!
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Previous
Reply
Map
View

Click here to load this message in the networking platform