VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Walkthrough to create your own dll files and access them through future programs!

by Jessy Butzke (11 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 17th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Walkthrough to create your own dll files and access them through future programs!

Rate Walkthrough to create your own dll files and access them through future programs!



Walkthrough to create a DLL
             By Jessy Butzke


NOTE: This walkthrough will guide you step for step on creating your own dll.
This will allow you to write multiple programs without having to type
the same code over again! All your programs can access these global
functions from 1 DLL File.

Steps:
(1) Open a New Project in VB6 and click on the icon "ActiveX DLL"
    This will open up and automatically put a class module in your
    project.
(2) Click on Project and then onto Project1 properties.
(3) Change the Project Name to the name of your dll file. 
            Example (MyDll) Then click on ok.
(4) In the Properties window for Class1, change the Instancing
            property to 6 - GlobalMultiUse.
(5) Put in your public functions in the coding window.
NOTE: Any function or sub that is public is what you will have
              access to. If it is private, you cannot access these functions.
              Only the code inside the dll can.
(6) After putting your public functions in, compile the dll.
NOTE: Make sure you have a copy of your new dll in the
              "c:\windows\system" directory.
(7) Open up MS-DOS and change the directory to "c:\windows\system"
NOTE: This will register your new dll.
(8) Type in: regsvr32 c:\windows\system\MyDll.dll
NOTE: Where it says MyDll.dll, you would put in your dll filename.

*
   That's it! you have created your dll.
   Now it's time to access your functions.
*

(1) Close out of everything and start a new project in VB6.
            Click on the icon "Standard EXE"
(2) Click on Project and then onto References.
(3) Find your dll name in the list, check it and click on ok.
(4) You will now have access to all your public functions and subs.
        EXAMPLE: If you had a Public Function like below in your dll:
Public Function Hello()
    MsgBox "Hello"
End Function

        You could use this call from your standard exe below:

Private Sub Command1_Click()
    Hello
End Sub

*
Dependancy Information. (Optional)
*

NOTE: Because your dll is new, VB6 does not have any dependancy information
      on it. This information is what's used to create a setup for your
      program.

(1) Rather than clicking on Standard Setup Package click on
            Dependancy File in the Package and development wizard.
(2) Go through the steps and when it comes up saying that it could
            not find any information on your dll, click on ok.
           (DO NOT CHECK THE BOX NEXT TO IT!)
(3) After all the steps, it has created a .DEP file in the path
            you told it to.
(4) Open this file in Notepad and copy the bottom part of the data
            to the clipboard.
NOTE: The data will look like this:

[MyDll.dll <0009>]
Dest=$(WinSysPath)
Date=11/15/00
Time=10:21
Version=1.0.0.0

(5) You will need to copy this information to your VB6dep.ini file
NOTE: If you copied it to your clipboard, you can now paste it out
              in the VB6dep.ini file.
NOTE: This file is usually located in: 
C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\VB6dep.ini

(6) After copying that information into VB6dep.ini, save it.

**
That's It! You can now make all the setups you want
and VB6 will automatically register your dll file
in the users computer that you installed your program
to.
**

Download this snippet    Add to My Saved Code

Walkthrough to create your own dll files and access them through future programs! Comments

No comments have been posted about Walkthrough to create your own dll files and access them through future programs!. Why not be the first to post a comment about Walkthrough to create your own dll files and access them through future programs!.

Post your comment

Subject:
Message:
0/1000 characters