BUG: Printing Reports in Loop Hangs Visual FoxProID: Q185865
|
Printing reports in loops generates an "Internal Consistency" error under Windows 95 and hangs Visual FoxPro under Windows NT 4.0.
This activity causes massive amounts of spooling, which causes a low memory situation because of continuous virtual memory swapping.
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:
In your application, replace the REPORT FORM command with the following lines of code:DEFINE CLASS PrintIt AS CUSTOM OLEPUBLIC WhichData='' WhichReport='' PROCEDURE PRINTOUT Use (This.WhichData) REPORT FORM (This.WhichReport) to Print Use ENDPROC ENDDEFINE
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
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
WARNING: Close all running applications and save your data before following this procedure. Note that following these steps may produce lost allocation units, lost clusters, or cross-linked files.
CREATE TABLE Test (ID c(4), NAME c(20)) INSERT INTO Test VALUES ("AAA","111") INSERT INTO Test VALUES ("BBB","222") INSERT INTO Test VALUES ("CCC","333")
SET SAFETY OFF FOR i=1 TO 5000 ?? i REPORT FORM Test TO FILE Test.txt ASCII NEXT
Additional query words: kbprint hang kbDSupport kbDSE VFP600REL kbvfp300 kbvfp300b kbvfp500 kbvfp500a kbvfp600
Keywords :
Version : WINDOWS:3.0,3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: August 3, 1999