Beginner VB

Moderators: None (Apply to moderate this forum)
Number of threads: 1244
Number of posts: 2990

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
What is Active-X Posted by maa77 on 7 Apr 2002 at 10:43 PM
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 ?

Report
Re: What is Active-X Posted by KDivad Leahcim on 8 Apr 2002 at 1:46 AM
: 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:
Public Sub ShowMessage(ByVal msg As String)

    MsgBox msg

End Sub

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:
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


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!



 

Recent Jobs