Downloading all images in a page

The following code receives a reference to IE or the web browser control. The code loops through all IMG tags and downloads those that have a picture associated with it. If you also retrieve the text ofa web page, you can store all the content of the page.
Read More…

VFP evaluates the ControlSource more often than you might think

When you activate or deactivate a form, VFP evaluates the ControlSource several times, even thoughRefresh isn't called, at all. As long as the ControlSource expression is valid, that's hardly an issue. Invalid ControlSources, however, show a peculiar behavior. In this case we're talking about propertiesbeing the ControlSource.
Read More…

Detecting a dopped down combo

VFP triggers the DropDown event when the dropdown part of a combobox is opened. Unfortuantely, there's no correlating DropUp event of any sort. So, you have to rely on other events that aretriggered in this case. The most important one is the When event. To distiguish a user moving the focus into the combobox and the user clicking on the dropdown button, you can use a flag that youset to .T. in the DropDown event. If When is triggered, and the flag is .T., then the user closedthe dropdown area. Set the flag to .F. in this case.
Read More…

Displaying an empty page

Displaying a page in a web browser control is easy. Just call Navigate2(). If you need to clear the display you can use the following line:
Read More…

Clicking sound

When you call the Navigate2 method in the web browser control, the browser plays the "start navigation" sound. By default, that's a brief clicking sound. To avoid the sound you need to hide the control while calling Navigate2. As this causes a lot of flickering, you want to lock the form while the control is invisible. For ActiveX controls you need to use the LockWindowUpdate() API function.
Read More…

Tabindex and SetFocus

TabIndex defines in which order VFP cycles through the container. It doesn't, however, define which control receives the focus if you set the focus to the parent object. If you call the SetFocus() method of a container, VFP sets the focus to the element that has been instantiated first. That is, VFP scans the Objects collection in pyhsical order and sets the focus to the first element that can receive the focus. VFP does NOT set the focus to the control with the lowest TabIndex. The following program demonstrates this.
Read More…