Home > Tutorials > How to Create an ActiveX DLL

How to Create an ActiveX DLL

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************

Step by Step instructions to create ActiveX Dll:

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. For example, Enter MyDll and click 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 access it.

6. After putting your public functions in, Save and Compile the DLL. (File -> Make Dll)

7. Now you need to register the DLL in order to use it in other projects. You can place the dll in "c:\windows\system" or a common location. Let's say you are placing the dll in "c:\windows\system" in this example.

8. Open the Run Dialog (Windows Key + R). And type regsvr32 "c:\windows\system\MyDll.dll". Here "c:\windows\system\" is the location of your Dll. "MyDll.dll" is the name of your Dll. You will get a message "DllRegisterServer in c:\windows\system\MyDll.dll succeeded".

That's it. Now you can start using the dll from other projects. You just need to add a reference to this dll. All public functions in your dll is accessible in your project.

If you would like to submit your code or tutorial here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.

| | | | $3.5 CPM No Minimum Payout