ASP DLL Information
When creating or using complex ASP web applications you will surely
run into one that requires the use of a DLL. The DLL usually includes
code that was compiled in VB, C++, or other Windows programming languages
to be used in the ASP application.
Registering a DLL
Before you can start using the code that resides in the DLL file, you must
first register the DLL with the windows runtime library. There are two ways
to let windows know about this new DLL.
- Save the DLL to C:\Windows\system32\
or
- Manually register it with the regsvr32 application
The first option is self-explanatory, but the second option takes a bit more work.
Here is a quick How-To on registering DLLs:
- Find out the location of your DLL. We will be using C:\Inetpub\wwwroot\tizagASP\myDLL.dll in this example.
- Click on the Start menu and choose Run
- Type in regsvr32.exe "C:\Inetpub\wwwroot\tizagASP\myDLL.dll" (With the quotes)
- You should get a confirmation message if it succeeded, such as: "DllRegisterServer in C:\Inetpub\wwwroot\tizagASP\myDLL.dll succeeded"
Using Your DLL in ASP
Now that you have registered your DLL you need to learn how to access
the functions that are contained within it. Let us assume for the sake
of this example that the DLL file is called "myDLL.dll" and the name
of the class is "myClass".
To create an instance of this class
you would use the Server.CreateObject method like so:
ASP Code:
<%
'Note this is example code, it will not work
' unless you create a myDLL, myClass, and a myMethod
Dim myObject
myObject = Server.CreateObject("myDLL.myClass")
myObject.myMethod("something")
myObject = nothing
%>
Found Something Wrong in this Lesson?Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time! |