Library tutorials & articles

A Real-Time VB6 ActiveX News Control

Compiling and using our new ActiveX control

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">
</OBJECT>


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

Comments

  1. 10 Jul 2002 at 00:15

    Good example.


    This is the first time played with any xmlhttp feeds, and found the example whet my appetite for more!  The code was not quite complete, but if you are familiar with vb then you should be able to fill in the blanks.  Once you get it working, you will no doubt see the other possible uses of this technology.


    Keep it real.

  2. 17 Apr 2002 at 15:18

    I've went thru the listing a few times, and it is not working for me at all....


    Things I noticed, the For loop he uses has no Next statement


    I'm probably overlooking something ....any suggestions?


    And after the LoadNews returns a TRUE it has EXIT function, shouldn't that be end?


    Thanks!


    Edit = typos

  3. 13 Apr 2002 at 05:31

    hmmm... yes... it seems the author hasn't released the entire VB project for the control. The hand icon will in fact be in your VB installation directory (in something like Shared/Icons/ along with the icons/toolbar bitmaps etc).

  4. 12 Apr 2002 at 15:16

    I see the images for the article, but not any hand images.

  5. 12 Apr 2002 at 14:02

    don't you see any images on http://www.developerfusion.com/show/2273/2/ ? Try hitting refresh on your browser....

  6. 12 Apr 2002 at 12:44

    I went to the article again and found no images?

  7. 12 Apr 2002 at 11:50

    There was one crucial thing missing from the article.... the images I have now added them, which might make it a bit easier for future readers

  8. 11 Apr 2002 at 14:57

    This was a somwehat confusing but very cool article once you get it working. What was frustrating was that the article indicated there was support material, but I cannot find any anywhere. This just made me really read the article and work with the project until I had it working.


    Great topic and a useful tool to add to any non-profit individual.


    BTW, I wonder what it costs to use for $$ purposes?

  9. 01 Jan 1999 at 00:00

    This thread is for discussions of A Real-Time VB6 ActiveX News Control.

Leave a comment

Sign in or Join us (it's free).