Microsoft KB Archive/253356: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "&" to "&")
m (Text replacement - """ to """)
 
Line 12: Line 12:
<div id="TitleRow">
<div id="TitleRow">


= <span id="KB253356"></span>PRB: &quot;API Call Caused an Exception&quot; Error Message with Third-Party Print Drivers =
= <span id="KB253356"></span>PRB: "API Call Caused an Exception" Error Message with Third-Party Print Drivers =




Line 70: Line 70:
== RESOLUTION ==
== RESOLUTION ==


Here is a workaround to the behavior. The error message &quot;API call caused an exception&quot; is trappable and reports an error number of 2028. The error can be handled by placing an '''_fpreset()''' function call and a retry command in an error-handling procedure. The following code demonstrates the basic structure for trapping this error:
Here is a workaround to the behavior. The error message "API call caused an exception" is trappable and reports an error number of 2028. The error can be handled by placing an '''_fpreset()''' function call and a retry command in an error-handling procedure. The following code demonstrates the basic structure for trapping this error:
<pre class="codesample">DECLARE _fpreset IN MSVCRT20.DLL
<pre class="codesample">DECLARE _fpreset IN MSVCRT20.DLL
ON ERROR DO errHand WITH ERROR()
ON ERROR DO errHand WITH ERROR()
SET LIBRARY TO HOME()+&quot;foxtools.fll&quot;
SET LIBRARY TO HOME()+"foxtools.fll"
SET PRINTER TO GETPRINTER()
SET PRINTER TO GETPRINTER()
? _wfindtitl(&quot;Command&quot;) && Error occurs at this point
? _wfindtitl("Command") && Error occurs at this point


PROCEDURE errHand
PROCEDURE errHand
Line 106: Line 106:
<li>Install a HP LaserJet 4000 PCL5e print driver.</li>
<li>Install a HP LaserJet 4000 PCL5e print driver.</li>
<li><p>Copy the following code into a FoxPro program:</p>
<li><p>Copy the following code into a FoxPro program:</p>
<pre class="codesample">SET LIBRARY TO HOME()+&quot;FOXTOOLS.FLL&quot;
<pre class="codesample">SET LIBRARY TO HOME()+"FOXTOOLS.FLL"
SET PRINTER TO GETPRINTER()
SET PRINTER TO GETPRINTER()
? _wfindtitl(&quot;command&quot;)
? _wfindtitl("command")
                     </pre></li>
                     </pre></li>
<li>Execute the new program.</li>
<li>Execute the new program.</li>
<li>Choose the HP LaserJet 4000 PCL5e print driver. The error message listed in the &quot;Symptoms&quot; section is displayed.</li></ol>
<li>Choose the HP LaserJet 4000 PCL5e print driver. The error message listed in the "Symptoms" section is displayed.</li></ol>





Latest revision as of 13:52, 21 July 2020

Article ID: 253356

Article Last Modified on 11/17/2003



APPLIES TO

  • Microsoft Visual FoxPro 6.0 Professional Edition, when used with:
    • Microsoft Windows 95
    • Microsoft Windows 98 Standard Edition



This article was previously published under Q253356

SYMPTOMS

When using a Hewlett Packard LaserJet 4000 PCL5e or other third-party print driver, a non-fatal error can occur:

API call caused an exception

CAUSE

The third-party print drivers are not resetting the floating point coprocessor.

RESOLUTION

Here is a workaround to the behavior. The error message "API call caused an exception" is trappable and reports an error number of 2028. The error can be handled by placing an _fpreset() function call and a retry command in an error-handling procedure. The following code demonstrates the basic structure for trapping this error:

DECLARE _fpreset IN MSVCRT20.DLL
ON ERROR DO errHand WITH ERROR()
SET LIBRARY TO HOME()+"foxtools.fll"
SET PRINTER TO GETPRINTER()
? _wfindtitl("Command") && Error occurs at this point

PROCEDURE errHand
PARAMETERS _lcError
   DO CASE
       CASE _lcError = 2028 && API call caused an exception
           _fpreset()
           RETRY
       OTHERWISE
               ERROR _lcError
       ENDCASE
ENDPROC
                

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Install a HP LaserJet 4000 PCL5e print driver.
  2. Copy the following code into a FoxPro program:

    SET LIBRARY TO HOME()+"FOXTOOLS.FLL"
    SET PRINTER TO GETPRINTER()
    ? _wfindtitl("command")
                        
  3. Execute the new program.
  4. Choose the HP LaserJet 4000 PCL5e print driver. The error message listed in the "Symptoms" section is displayed.


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

183522 FIX: Divide by Zero Creates Err with Third-Party Print Drivers


182137 PRB: Memory Error with HP LaserJet 4000 TN PCL 5e Driver


Keywords: kbprint kbprb kb3rdparty KB253356