VISUAL BASIC_6
 

10. Project using ActiveX DLL


What is DLL?

A dynamic-link library(DLL) is a set of procedures that are external to your application, and can be called from your application.  DLLs are not bound to your executable file, and so they can be linked to your application at run time, instead of being loaded at compile time.   The libraries can be updated independently of the application and multiple applications can share a single DLL. 

Advantages of using DLLs:

    DLLs can accomplish tasks that are difficult with VB.

    DLLS will run faster than VB code resulting in improved performance.

    DLLs can be updated independently of the application.

Declaring a DLL Procedure:

DLL procedures reside in files that are external to your VB application and so you must declare a procedure before you call it.   Declaring a procedure provides VB with the information it needs to find and run the procedure you want to use.

Steps used in creating an ActiveX DLL Project:

1.    Open the VB IDE.

2.    Select New Project from the File Menu.   You will get the Project window as shown in the figure 1.   Select the icon named ActiveX DLL.   


                        Figure 1

3.    Add a form to the Project using the Add Form window shown in the figure 2.   This window is obtained by selecting Add Form from the Project Menu.. Change its name property as chartfrm.


                               Figure 2

4.    Change the name property of the project as chartprj.

5.    Change the name property of the class modules as chartcls.

6.    Drag a MSChart control in the form and size it appropriately as shown in the figure 3.

7.    Save the modules as chartcls, the form as chartfrm and the project as chartprj.   These names must appear as shown in the figure 3.


                          Figure 3


 

Copyright © 2001 Selfonline-Education. All rights reserved.