Microsoft KB Archive/163412

= FIX: Web Browser Position is Wrong on Pageframe Page =

Article ID: 163412

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q163412



SYMPTOMS
When a Visual FoxPro for Windows version 5.0 form contains a pageframe, and one of the pages (other than page 1) of the pageframe has an OLE container control that houses the Microsoft Web Browser control, that container control will appear on the page in the wrong location at runtime.

It will be positioned to the upper left of where it was positioned at design time. Because it is still located on the pageframe, its dimensions will be shrunken so that it fits on the page.

If the Web Browser is located on the first page of the pageframe, its loading will throw the error:

"OLE error code 0x80004005. Unspecified error."

There is no known workaround for this error. The control will be drawn on page 1 but will be larger than intended, obscuring the tabs for the remaining pages in the pageframe.



RESOLUTION
The following workaround applies only to placement of the Web Browser of pages other than page 1 of the pageframe control.

The location of the OLEContainer control can be reset in the Activate event method of the page of the pageframe containing the control. An example of the code to do this follows: This.Olecontrol1.Left = 0 This workaround will fail if the active page from which you move contains any of the OCX (ActiveX) controls that install with Visual FoxPro. If you switch from a page with an ActiveX control to the page with the Web Browser, the error will cause the Web Browser to locate at the upper left of where it should be.

To position the Web Browser correctly, you must first switch from a page with an ActiveX control to a page without one, and then to the page with the Web Browser control.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft product listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0.



Steps to Reproduce Behavior
 Create a new form. Add a pageframe to the form. Add a web browser (Microsoft Web Browser) control to page 2 of the pageframe. Size it so it takes up most of the page.

The steps to add this are as follows:

 Right-click on the pageframe, and select "Edit" on the context menu. Click the tab for page 2. Click the OLEContainer control tool on the toolbar.</li> Position the mouse at the upper left of page 2.</li> Drag the mouse to the lower-right corner of page 2.</li> From the Insert Object dialog box, click the "Insert Control" option button, and then select "Microsoft Web Browser Control" from the list. If you do not see that option, install Microsoft Internet Explorer 3.01 by downloading it from the Internet. It will install the Web Browser in your Windows\System (on Windows 95) or Windows\System32 (for Windows NT) directory. The file name of the control is shdocvw.dll.</li></ol> </li>  Add the following code to the init event method of the OLEContainer control (OLEContainer1): This.navigate("http://www.microsoft.com") </li> Run the form and click the tab for page 2.</li></ol>

Additional query words: kbvfp600fix

Keywords: kbbug kbfix kbinterop KB163412

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.