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



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft Visual FoxPro 8.0
  • 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

  1. 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
    							
  2. Place the following code in a new program file named CallIt.prg:
          oX=CREATEOBJECT("MyServer.MyClass")
          oX.RunIt
          RELEASE oX
    							
  3. Run the CallIt program.

REFERENCES

Visual FoxPro Help; search on "sys(2335)"; topic: "SYS(2335) - Unattended Server Mode"

Modification Type:MajorLast Reviewed:2/17/2005
Keywords:kbnofix kbprb KB191639