DOCUMENT:Q253356 11-SEP-2001 [foxpro] TITLE :PRB: "API Call Caused an Exception" with 3rd-Party Print Drivers PRODUCT :Microsoft FoxPro PROD/VER:WINDOWS:6.0 OPER/SYS: KEYWORDS:kb3rdparty kbprint kbPrinting kbvfp600 kbOSWin95 kbOSWin98 kbGrpDSFox kbDSupport ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, version 6.0, on platform(s): - the operating system: Microsoft Windows 95 - the operating system: Microsoft Windows 98 ------------------------------------------------------------------------------- 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: Q183522 FIX: Divide by Zero Creates Err with Third-Party Print Drivers Q182137 PRB: Memory Error with HP LaserJet 4000 TN PCL 5e Driver Additional query words: ====================================================================== Keywords : kb3rdparty kbprint kbPrinting kbvfp600 kbOSWin95 kbOSWin98 kbGrpDSFox kbDSupport Technology : kbVFPsearch kbAudDeveloper Version : WINDOWS:6.0 Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.