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:
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":
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:
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:
A Real-Time VB6 ActiveX News Control
- Introduction
- Creating the ActiveX control
- Obtaining our news with XMLHTTP
- Displaying the link
- Compiling and using our new ActiveX control
- Conclusion
Compiling and using our new ActiveX control
You might also like...
About the author
Mitchell Harper
Visit http://www.devarticles.com for more articles and free programming eBooks, or visit Socket6.com for your dose o...
Interested in writing for us? Find out more.
XML books
-
Programming with Microsoft Visual Basic 2008
Programming with Microsoft Visual Basic 2008, Fourth Edition by the best-selling author, Diane Zak, is designed for a first course in programming. Using the most recent version of the software, Visual Basic 2008, this book teaches individuals how to ...
XML forum discussion
-
CorelDRAW VBA: cdrTraceLineDrawing FAILS, producing single linear path instead of Centerline trace?
by dancemanj (0 replies)
-
client/server application using activex
by beautifulheart (0 replies)
-
System Error &H8007007E. The specifed module could not be found.
by swiftsafe (5 replies)
-
Invitation to take part in an academic research study
by researchlab (0 replies)
-
Send SMS with SMPP
by mmahmoud (0 replies)
XML podcasts
-
Stack Overflow Podcast: Podcast #45 – Keeping it Sharp
Published 7 years ago, running time 0h54m
Our guest this week is Eric Lippert – language architect extraordinaire and famous for all his work at Microsoft in developing their languages Eric joined Microsoft right out of college and was originally working on VB It’s time for everyone’s favorite game: Name the Worst Feature of that Microso.
Comments