Microsoft KB Archive/266363

= BUG: Fatal Error When You Close Forms That Use DHTML Edit Control =

Article ID: 266363

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q266363



SYMPTOMS
When you release a form being executed that contains a Dynamic HTML Edit Control (DHTMLed.ocx), a fatal exception error may occur.



CAUSE
The fatal exception error occurs when the _VFP.AutoYield property is set to False (.F.). The fatal exception error may occur on Microsoft Windows 2000, regardless of the setting of the _VFP.AutoYield property.



RESOLUTION
When you execute forms that contain the Dynamic HTML Edit Control, set the _VFP.AutoYield property to True (.T.).

NOTE: Setting the _VFP.AutoYield property to True (.T.) does not prevent the occurrence of a fatal exception on Windows 2000.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
NOTE: The Microsoft Dynamic HTML Edit Control has not been tested with and may not be supported by Microsoft Visual FoxPro.

This behavior does not occur when forms containing the Dynamic HTML Edit Control are released on Microsoft Windows NT 4.0.

This behavior occurs when Microsoft Visual FoxPro forms that contain the Dynamic HTML Edit Control are released on the Microsoft Windows 2000 Server, regardless of the value of _VFP.AutoYield.

The Visual FoxPro Help Documentation indicates that the AutoYield property should be set to False (.F.) when a form contains an ActiveX control. Setting AutoYield to False (.F.) prevents events for an ActiveX control from executing between lines of user program code.

Steps to Reproduce Behavior
  Create a program file named Dhtml.prg, by using the following code: PUBLIC ox OldAutoYield=_VFP.AutoYield _VFP.AutoYield=.T. FOR i=1 TO 10 ox=CREATEOBJECT(&quot;DEMO&quot;) ox.SHOW IF _VFP.AUTOYIELD WAIT WINDOW &quot;AutoYield = TRUE&quot; NOWA ELSE WAIT WINDOW &quot;AutoYield = FALSE&quot; NOWA ENDIF FOR EACH oform IN _SCREEN.FORMS oform.RELEASE ENDFOR IF i=5 _VFP.AUTOYIELD=.F.  ENDIF ENDFOR _VFP.AUTOYIELD=OldAutoYield
 * !* Reset the AutoYield property to default

DEFINE CLASS demo AS FORM TOP = 0 LEFT = 0 AUTOCENTER = .T.  HEIGHT = 454 WIDTH = 633 DOCREATE = .T.  CAPTION = &quot;Form1&quot; NAME = &quot;Form1&quot;

ADD OBJECT olecontrol1 AS OLECONTROL WITH ; TOP = 24, ; LEFT = 12, ; HEIGHT = 276, ; WIDTH = 612, ; NAME = &quot;Olecontrol1&quot;, ; OLECLASS = &quot;DHTMLEdit.DHTMLEdit.1&quot;

ADD OBJECT text1 AS TEXTBOX WITH ; VALUE = &quot;http://www.msn.com&quot;, ; HEIGHT = 25, ; LEFT = 24, ; TOP = 408, ; WIDTH = 577, ; NAME = &quot;Text1&quot;

ADD OBJECT command1 AS COMMANDBUTTON WITH ; TOP = 324, ; LEFT = 24, ; HEIGHT = 25, ; WIDTH = 145, ; CAPTION = &quot;\ Save and run the program file, and note that after the fifth iteration, a fatal exception error may occur.

