Home arrow Visual Basic arrow Page 2 - A Real-Time ActiveX News Control

A Real-Time ActiveX News Control

A while back, Mitchell wrote an article about MoreOver.com and their XML news sources (which are free for developers using them for non-profit purposes). Today, Mitchell takes that idea one step further and creates an ActiveX component that uses the MoreOver.com news feeds in a similar way. The component uses the XMLHTTP library and the MSXML parser to retrieve and process the news. This article also acts as a good introduction to ActiveX controls if you have never created one before.

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 10
December 22, 2001
  1. · A Real-Time ActiveX News Control
  2. · Creating the ActiveX control
  3. · Obtaining our news with XMLHTTP
  4. · Displaying the link
  5. · Compiling and using our new ActiveX control
  6. · Conclusion

print this article

A Real-Time ActiveX News Control - Creating the ActiveX control
(Page 2 of 6 )

Our ActiveX control will contact the MoreOver.com server using XMLHTTP. It will retrieve an XML document containing a list of news items. In this case, we will be retrieving video game news. Each entry in the XML file will contain a URL, headline text, source, media type, cluster, tagline, document URL and harvest time, as shown below:

A sample XML news item from MoreOver.com

We will use the five most recent items in the returned XML file and create a hyperlink to each one in a new browser window. The hyperlink will feature a proper hand icon, and while the XML is being retrieved in the background, a progress bar will display the status of the retrieval.

Start by firing up Microsoft Visual Basic 6. Choose the ActiveX Control option and click on the OK button, as shown below:

Creating our new ActiveX Control

Name your project "prjXMLNews" and your control "ctrlNews". Set its background colour to white. Resize the control so that it's about 2500 twips wide by 5400 tips in length. When the XML document is being retrieved from the MoreOver.com server, our control will display a progress bar telling the user what is going on. We need to use the Project -> Components menu option to add the "Microsoft Windows Common Controls 6.0" library to our project. This will allow us to drop a progress bar onto our control. We also need a reference to the "Microsoft XML, v4.0" library.

Also, as mentioned above, our control will display the five most recent XML items retrieved from the MoreOver.com new feed. Each one will be displayed as a label control, which will have hyperlink to the actual URL of the news story.

There are a number of ways that we can retrieve the icon for the hyperlink (you know, the "hand" icon). Because we are creating an ActiveX control, I have chosen to add a picture box, with its Picture property set to the actual image of the hand cursor. The location for this cursor varies from machine to machine, so I have already included it as part of the control.

So far, our ActiveX control looks like this:

The design of our ActiveX control, so far

Now that I've described how the control will operate, and what it will look like, let's talk about using the XMLHTTP library to retrieve our XML news from MoreOver.com.
blog comments powered by Disqus

- Developing an XML Web Service Using Visual S...
- Creating an HTML File List with VB
- Fun with Email: VB6, CDO, MAPI, and a Remote...
- Extranet/Intranet Dictionary Cracker in VB
- Finding Default App Icons With Visual Basic
- Registry Fever With Visual Basic
- Implementing An ADO Data Control With VB6
- Printing With Visual Basic
- MSMQ Part 1/2: Architecture and Simple Imple...
- Magnifying The Desktop With Visual Basic
- Sending Email With MAPI Components in Visual...
- Two Person Chat With The Winsock Control And...
- A Real-Time ActiveX News Control
- Accessing the Windows API in Visual Basic

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials