Home arrow Visual Basic arrow Page 5 - 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 - Compiling and using our new ActiveX control
(Page 5 of 6 )

Because Visual Basic is such a tightly integrated IDE, all we have to do to compile and create our ActiveX control is choose File -> Make prjXMLNews.ocx. Visual Basic will handle the entire library linking and referencing process by itself.

Once the Visual Basic compiler has finished doing its thing, we will be left with a single file, prjXMLNews.ocx. Visual Basic automatically registers our new ActiveX control for us, so all that we have to do is add it to our project.

To do this, we fire up a new instance of Visual Basic and create a standard executable. Using the Project -> Components (or Ctrl+T) menu option, we simply add our ActiveX object as an available control ns our project, like this:

Adding our ActiveX control to a new project is eas

Click OK and take a look at your side tool bar. You should see a new control. Move your mouse over the control, and its tooltip text should display "ctrlNews":

Our ActiveX control is now available from the cont

Now it's simply a matter of double-clicking on the control to add it to our new projects main form. Notice how the control actually shows the news items on it? Resize the control to make sure all of the news items are displayed, and then run the app.

Moving your mouse over any of the labels will show the hand cursor. Clicking on one will open the URL of that news item in a new browser window. If you take your control and play around with it a bit, you can create a neat looking form, like mine, which is shown below:

My implementation of our new ActiveX control

Using our new ActiveX control on a web page is easy as well. Make sure you have your ActiveX controlís source coded loaded in Visual Basic. Now, click on the Play button. This will launch the ActiveX control in a new web browser window. View the source of that page, and copy the entire <OBJECT> tag. It should look something like this:

<OBJECT classid="clsid:B6091979-A970-4967-9257-5372182BC3AA">


The classid value is a unique identifier which windows stores in the registry, along with other details of our new ActiveX control, such as its AppId, and ProgId. Simply paste the <OBJECT> tag into a HTML page and save that HTML page on your machine. Fire the page up in your web browser, and our new ActiveX control will be displayed:

Our new ActiveX control in Internet Explorer
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