FIX: Printing reports in a loop hangs Visual FoxPro (185865)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q185865 SYMPTOMS
Printing reports in loops generates an "Internal Consistency" error under
Windows 95 and hangs Visual FoxPro under Windows NT 4.0.
CAUSE
This activity causes massive amounts of spooling, which causes a low memory
situation because of continuous virtual memory swapping.
RESOLUTION
Create an out-of-process Visual FoxPro OLE server to handle the printing
and release the object when the printing is completed. This workaround is
available only in versions of Visual FoxPro later than 3.0x.
An example is shown below.
Create an OLE server named "TestPrint" by creating a project, adding the
following code to a program file, and compiling the project to an EXE file:
DEFINE CLASS PrintIt AS CUSTOM OLEPUBLIC
WhichData=''
WhichReport=''
PROCEDURE PRINTOUT
Use (This.WhichData)
REPORT FORM (This.WhichReport) to Print
Use
ENDPROC
ENDDEFINE
In your application, replace the REPORT FORM command with the following
lines of code:
Ox=CreateObject("TestPrint.PrintIt")
Ox.WhichData ="<Full Path of the Table associated with the report>"
Ox.WhichReport="<Full Path of the Report>"
Ox.PRINTOUT
Release OX
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
Modification Type: | Major | Last Reviewed: | 2/11/2005 |
---|
Keywords: | kbbug kbfix kbprint KB185865 |
---|
|