• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3413
  • Last Modified:

Active X Controls programming on the WEB

Can someone, in there own words not from the glossary or from Microsoft, define and explain for me how Active X Controls plays a part of programming for WEB applications in conjunction with VB. There are so many definitions that it becomes confusing!
  • 2
  • 2
  • 2
  • +2
1 Solution
You should only use ActiveX if you only want Microsoft Windows Clients.  You should only use a combination of HTML and Javascript if you also wish MAC/Unix/Linux/MainFrame clients to visit your site.

VBScript and ActiveX are ideal for use in an intranet environment where you can control which OS your clients are using.

VB provides a system for use this non-microsft clients.  The system is called web-classes.  However, IMHO, there best way for creating VB for a web application is you use an ActiveX DLL.

So in your ASP page you need a simple bit of code that starts the DLL.  

---------Sample ASP page
Option Explicit

'Const CurrentDLL = "MyDLL100.MyClass" ' previous version
Const CurrentDLL = "MyDLL101.MyClass" ' enhanced version

Dim Ok

On Error Resume Next
    Set MyDLL = Server.CreateObject(CurrentDLL)
    If Err.Number<> 0 Then Exit Do
    OK = MyDLL.GetPageOK(Server, Application, Session, Request, Response)
    Exit Do

If Not OK Then
    Response.Redirect "http://yourserver.com/sitefault.htm"
End If

Set MyDLL = Nothing


----End of Sample

So now all you need is some VB DLL code to create the HTML that you wish to display.

If you wish I can post a simple sample.

Hope this helps:~)

Here is a site which I created using an ActiveX DLL.


Here is the sub that the ASP page activates:

Public Function A_ProcessRequestASPOK(pServer As ASPTypeLibrary.Server, _
  pApplication As ASPTypeLibrary.Application, _
  pSession As ASPTypeLibrary.Session, pRequest As ASPTypeLibrary.Request, _
  pResponse As ASPTypeLibrary.Response)

A_ProcessRequestASPOK = False

On Error Goto ErrorTrap

' Set a project reference to ASP.DLL to gain access to
' the IIS objects passed as parameters from the ASP page.

Set Server = pServer
Set Application = pApplication
Set Session = pSession
Set Request = pRequest
Set Response = pResponse


A_ProcessRequestASPOK = True

Exit Function


SaveErrorDetails Err

End Function

The sub A_ProcessRequestVB decides what the operator wants to do then calls an appropriate sub to create the html.

But in simple terms each sub does things like this:

HTMLData = "<HTML><BODY>Hello world</BODY></HTML>"

Response.Write HTMLData
Mostly there is something you should do that you cannot with javascript (such as file operations on client, dialing from users computers to somewhere, to securify a db connection from client and your db ...) you create an activex control when it first invokes it installs itself to clint then continue running when invoked.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


If you are still looking for the answer here is my bit.

An ActiveX control can be used as a component in a web page. Such a component is embedded in a web page with the <OBJECT> tag of HTML. You need to specify the ProgID in the page to instantiate a control. The ProgID or CLSID of a control may be retrieved manually from the system registry. However, to make things simple you may use any of the available tools. One such tool commonly used in early days was Microsoft ActiveX Control Pad. When a web page containing an <OBJECT> tag loads it downloads the control from the location specified in CodeBase parameter, if not already done.

Having said that, I must maintain, using ActiveX to build web pages is no longer in fashion. Yes there was a time (when this technology was new) when some people did use it, but now? No one uses it any more.

So, what do you do with this technology?

As Microsoft would have liked us to believe (atleast till there was no .Net technology), there is nothing better than ActiveX. They did not only push ActiveX control but also ActiveX document technology as a web development technology. But unfortunately, barring ActiveX Dll and ASP, all ohter MS technologies failed.

So, why would you like to use ActiveX control in a web page now that you have something like .Net at your disposal, which gives you more power and flexibility in doing the same more elegantly?

The answer is: only if you want to learn OR only if you can not leave your good old plain vanilla VB. OR you do not want or your organization does not want to invest in .Net.

As pointed out earlier, it is only advisable to use ActiveX in an intranet environment, where you have direct control over the client machines. Consider putting online a website website based on ActiveX controls. You lose on a large chunk of visitors, plus the ones who do have IE even they might have security restrictions which may force your control to close shop.

Verdict: Do not think of using ActiveX unless you have gone too far OR unless you know the pitfalls. It may seem an easy solution to begin with but will cost you dear in a long run.
GlobalFaxAuthor Commented:
Thanks, just what I was lookig for!
GlobalFaxAuthor Commented:
Answer Accepted
Glad I could get you the info you wanted.

I came across the question while searching EE and cannot resist the temptation to respond albeit the issue is PAQ and closed.

"using ActiveX to build web pages is no longer in fashion"

That is true, but could very well change in the future.

"So, why would you like to use ActiveX control in a web page now that you have something like .Net at your disposal, which gives you more power and flexibility in doing the same more elegantly?"

Because it will take at least 4-5 years more until we can assume that .NET framework is installed on 95% of all users. And VB6 code is much faster.

Client Side ActiveX Control did not catch on for different reasons that no longer apply.
1) Navigator choosed not to support ActiveX, now more than 95% use IE.
2) A VB6 control (50-60k) was a huge download because of all the supporting files that was needed; now all this files can be assumed to exist on the user machine.
3) Before many people used modems, now almost everybody have broadband.

"It may seem an easy solution to begin with”

To get a control properly digitally signed by an official Provider like Verysign or Thawte and get the internet deployment package correctly is not easy - on the contrary "only for experts."

But you only have problem the first time, after that it really solves a lot of problem, especially in Intranet environments.
The control only needs to be downloaded the first time you visit the page, after that you never notice it.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now