Upload
robertbenard
View
1.251
Download
0
Tags:
Embed Size (px)
Citation preview
OBJECT ORIENTED PROGRAMMING - DLLS
Advanced Visual Basic
Overview
A dynamic-link library (DLL) is an executable file that acts as a shared library of functions. Dynamic linking provides a way for a process to call a function that is not part of its executable code. The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked, and stored separately from the processes that use them. DLLs also facilitate the sharing of data and resources. Multiple applications can simultaneously access the contents of a single copy of a DLL in memory.
Where you see DLLs
DLLs (direct link libraries) are used throughout the Windows operating system.
You can find many DLLs in the c:\Windows\System32 directory on your computer
Why use DLLs?
Research Question:
Why is it advantageous to use DLLs in programming?
Why use DLLs?
DLLs can be used for many purposes including:
• Sharing of resources• Reduction of hard disk storage space requirements• Easier updates of applications
Creation of a DLL
DLLs can be created easily through Visual Basic.
1. Create a new class library
2. Create a public sub in the class library to be accessed by another application
3. Save
4. Click Build DLL
Public Class Class1Public Sub HelloWorld()
MsgBox("Hello world")End Sub
End Class
Use a DLL
DLLs can be used in Visual Basic by adding them as a resource to an application.
1. Click Project
2. Add Resource
3. Browse for the DLL file you created
4. Add code to your application to access the DLL code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t As New Class1t.HelloWorld()
End Sub
DLLs
Research Question:
Where might you use a DLL?
Additional Information
For additional information about these topics, please the links provided in Blackboard.