Your DesktopX Documentation Resource Guide

Documentation Home

Quick Start

User's Guide

Developer's Guide



Internet access via DesktopX objects

Microsoft.XmlHttp object

You instantiate this COM object from a script. For instance, say you want to download an html file data you can adapt this code:

'Creates an instance of Microsoft.XmlHttp
Set http = CreateObject("Microsoft.XmlHttp")

'Disables error prompts
On Error Resume Next

'Sets the URL to download
url = "
http.Open "GET", url, False

'Receives data
http.send ""
sWebpage = http.responseText

This is a very simple yet effective way to download data from the internet. Possibly the only limitation is that the method is synchronous, that is, it will block the script execution until the data finished downloading. The interface could hang until the script finished its job. Still, this can be fast and reasonable for most cases.

Please refer MSDN help on how to use XMLHTTP object.

A more complex method of accessing internet data is to use the Microsoft Web Browser.

Microsoft Web Browser control

You can create an hidden MS Web Browser ActiveX control to download internet data. This object is very powerful and can be used for different purposes than the actual html rendering.

Refer MSDN references on this object for information on how to access various html elements, modify the presentation, properties, etc.

As a quick start, create a blank object. Then add a new script. In the menu select "ActiveX control...". Scroll down and select "Microsoft Web Browser".

You can use this simple method to navigate to a page:

Control.navigate2 ""

Select "Event Wizard.." in the script editor menu and add this event:

'Fired when the document being navigated to reaches ReadyState_Complete.
Sub Control_DocumentComplete(pDisp, URL)

End sub

This function is called when the page finished loading. The mechanism is asynchronous, so Object.Navigate2 won't block the script execution flow.

When the document is complete you can use the control methods to access the page data. The simpliest one is:


It will return the whole page content.

Passing URL parameters

When you are passing URL parameters, no matter what method you choose, make sure to correctly escape the text parameters if they can contain special characters.

The VBScript method to do this is:


Design guidelines

Widgets and themes that access the Internet are the most difficult to write properly so they deserve particular attention.
You just can’t assume that a user is connected to the Internet, so browsing could fail and cause very annoying script errors. You should ALWAYS check the connection status, and also check about the success of browsing operations. You should assume that you can retrieve NULL or invalid data.
Also, objects that connect to the Internet should follow a specific usage protocol to avoid annoyances. They should keep an internal connection status that just informs the script about “Can I try to access the Internet? YES/NO”. This is different from the actual connection status, in fact it is more similar to the Internet Explorer Online/Offline status, that’s independent from the actual network connection status.
A tentative protocol works like this:

  • Have a global script variable, e.g. IsConnected.
  • When IsConnected is changed to TRUE, the object can update and retrieve info from the Internet. It can also start a timer to periodically do that.
  • When IsConnected is changed to FALSE, the object won’t try to retrieve info from the internet. Any timer that does that is “killed”.
  • IsConnected can be first set on OnScriptEnter by checking for the actual connection status by calling System.InternetConnected and setting IsConnected accordingly.
  • When IsConnected is FALSE, the objects GUI should represent this status. I.e. you can use a text object that shows a red “Offline” text. From here on, only the user can manually retry to set IsConnected to TRUE (i.e. by clicking another DX object). Here is another System.InternetConnected check and IsConnected is set accordingly.
  • The user can manually set the Offline status as well. I.e. one could just not want an object to keep updating from the Internet.


SkinStudio 6.2 Released


A God Has Fallen - New Demigod Trailer Released


Sins of a Solar Empire v1.1 Beta has Arrived


Stardock Releases New WindowBlinds 6.2 Update


Stardock Releases The Political Machine v1.04 with New Characters


Stardock Releases MyColors 2.5


DesktopX 3.5 Officially Released


Corel WinDVD 9 and Painter X Now Available on Impulse!