Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2005, 07:11 PM
Registered User
 
Join Date: Feb 2005
Location: Washington, DC, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To Create A Simple DLL with VB6

I'm trying to create a simple .dll for use with some of my more commonly used functions in VB. I have had a difficult time finding an example of code by searching the web. Does anyone have a simple-stupid example?

Reply With Quote
  #2 (permalink)  
Old February 23rd, 2005, 01:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't know how much you need, but see if you can use any of this:

http://p2p.wrox.com/topic.asp?TOPIC_ID=13521

It's simple to use in VB. Make a new exe, add a class module, name it TC1 and add the class code to this. In the exe form, add a commandbutton and this code:

Private Sub Command1_Click()
Dim TC As TC1
Set TC = New TC1

TC.FirstName = "myFirstName"
TC.LastName = "andMyLastName"

MsgBox TC.BothNames
Set TC = Nothing
End Sub

..and from here, what you can do within the class, you'll have to have help from someone else. ;)
Reply With Quote
  #3 (permalink)  
Old February 23rd, 2005, 04:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Open VB, select new Project and select ActiveX dll. Name the project (that will be the name of the library to reference to). The project comes already with a public class named Class1. Change that name to something more useful. Now, all the public methods and properties that you add in that class will be exposed by the library. Build it, then go to project properties, and in the Component tab select binary compatibility. This is extreme important. It means that after your library is built, you cannot remove public objects or methods, and you cannot change the definitions of public methods. You can indeed add new public classes and methods.

To test the library, File->Add Project and create a new exe project. Right click in the project explorer and select Set at start up. You can use your library from the new projects, and when you are debugging you can step in in every files.
This is just to give you a start. Full documentation in

http://msdn.microsoft.com/library/de...scomponent.asp

Marco
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Reference to VB6 DLL webnet .NET Framework 2.0 3 October 4th, 2007 11:41 AM
Use .net dll in VB6? wakeup .NET Framework 2.0 3 March 8th, 2006 05:39 PM
Using .NET Dll from VB6 application Dmitriy Pro VB 6 5 January 30th, 2006 04:43 PM
VB6 DLL with Forms ................. Please Help tact_259 VB Components 0 November 16th, 2004 06:41 AM
Creation of ActiveX DLL with VB6 james gold Pro VB 6 2 September 10th, 2003 08:19 AM



All times are GMT -4. The time now is 12:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.