Microsoft KB Archive/191639

= You receive an error message when the REPORT FORM command is used in a Visual FoxPro COM DLL =

Article ID: 191639

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q191639



SYMPTOMS
Running the Report command within an in-process OLE component created in Microsoft Visual FoxPro 6.0 or later versions, returns an error indicating that the User- Interface operation is not allowed at this time.



CAUSE
The Report command calls the User Interface functions in order to properly run the report. User Interface functions are no longer allowed in in- process Component Object Model (COM) servers created in Microsoft Visual FoxPro.



RESOLUTION
Create a Local COM server (.exe) in Visual FoxPro that can be called by the in-process server to run the report, or build the original object as a Local COM server (.exe).



STATUS
This behavior is by design.



MORE INFORMATION
The full text of the error message returned that follows, uses the file, class and procedure name used in the Steps to Reproduce Behavior section of this article. The path specified in the error message will also vary depending on the file location.

OLE IDispatch exception code 1031 from MyServer.MyClass: .runit e:\data\beta\ole\dll\dllmain.prg Error in line 4 User-Interface operation not allowed at this time. 1031..

Steps to Reproduce Behavior
  Place the following code in a program file named DllMain.prg in a new project and build it as a COM DLL named MyServer.dll. Select Ignore when you build the .dll if the Project Manager reports that it can not find the report named rpt1. DEFINE CLASS MyClass AS CUSTOM OLEPUBLIC MyName="MyClass" PROCEDURE runit REPORT FORM rpt1 TO PRINTER NOCONSOLE NOWAIT ENDPROC ENDDEFINE   Place the following code in a new program file named CallIt.prg: oX=CREATEOBJECT("MyServer.MyClass") oX.RunIt RELEASE oX                            Run the CallIt program.

