What is Active-X

I'm quite new to visual basic 6. I created a new project "standard.exe" and able to calculate and do something. SO i just wondering what is actually active-x ? IF i would like to upgrade my "standard.exe" project to some kind of active-x project, can i do that ?

Comments

  • : I'm quite new to visual basic 6. I created a new project "standard.exe" and able to calculate and do something. SO i just wondering what is actually active-x ? IF i would like to upgrade my "standard.exe" project to some kind of active-x project, can i do that ?
    :
    :

    That's quite a question you are asking! To put it as simple as I can:

    ActiveX is a method of using another executable as part of your app.

    The executable (exe, dll, ocx) must be written using ActiveX technology. This "exports" certain classes from the component to be used by another executable. Although C++ can use and/or export ActiveX components (heck, even asm can do it if you know how), VB is the major player in this area.

    Here's an example:

    Create a new project of type ActiveX dll.
    In the class module (Class1), add this:
    [code]
    Public Sub ShowMessage(ByVal msg As String)

    MsgBox msg

    End Sub
    [/code]
    Change the project name to MyDLL.
    Compile this project (File - Make MyDLL.dll).

    Start a new project of type standard exe.
    (On the menu) Go to Project - References.
    Place a check next to MyDLL, click OK.
    Place a command button on the form, open the code window for it.
    Place this code in it:
    [code]
    Private Sub Command1_Click()

    Dim x As MyDLL.Class1
    Set x = New MyDLL.Class1
    x.ShowMessage "I used ActiveX!"
    Set x = Nothing 'ALWAYS clear all objects!
    Unload Me 'Unload the form

    End Sub
    [/code]

    You can "upgrade" your app to use ActiveX simply by selecting one of the activex project types and using it, but exactly how depends on what you are after.

    Hope this helps!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion