Solved

Creating a DLL file

Posted on 1998-11-29
9
148 Views
Last Modified: 2010-05-03
How do I create a dll file some sample code would be nice.
thank you.

You can email me at sear@nastything.com
0
Comment
Question by:cwrjr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 2

Expert Comment

by:trillo
ID: 1447356
It's time for you to move to a new programming lenguaje such as Delphi or C++. Unfortunately you can't create DLL's in VB. ... By now you'll be saying "That's not true, on the VB compiler there are options to make DLL's".... And It's true, but those are ActiveX DLL's, this means that you can't store in a DLL normal functions (even as they are as simple to just add two numbers).
Trillo
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1447357
Trillo, is right. Please answer the question.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1447358
Oeps, mistake, reject mine please.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:gertt
ID: 1447359
nice answer trillo?!. DLL=activeX
In VB you can use activeX DLL or Document DLL, MSDN (on microsoft site) explains!
Windows is made by VB so nothing Delphi...
0
 
LVL 2

Expert Comment

by:dm_14
ID: 1447360
You don't have to write DLLs using C++ or Delphi !

You can write DLLs in BASIC using PowerBASIC's DLL Compiler. I have used their product in several apps, its fast and simple. The transition was painless and their DLLs are not ActiveX DLLs.

0
 
LVL 2

Expert Comment

by:trillo
ID: 1447361
To Gertt
a)
>> Windows is made by VB
  Windows is made by VB?......Wrong!.... Windows is mostly mado by C++
b)
>> In VB you can use activeX DLL or Document DLL, MSDN (on microsoft site) explains!
  cwrjr is asking how to CREATE DLL's in VB not if he can use them.

To dm_14
I didn't say you MUST use C++ or Delphi, I said languages SUCH AS C++ or Delphi.
Trillo
0
 

Author Comment

by:cwrjr
ID: 1447362
no solution
0
 
LVL 3

Accepted Solution

by:
jjbyers earned 20 total points
ID: 1447363
Start VB5 and select ActiveX Dll for a project.

Rename Project to ProjTest

Under properties select Unattended Execution, Apartment Threading Model.

Rename Class1 to cTest

Add the Following code to the class module.

Option Explicit

Public function ReturnTxt() as String
  ReturnTxt="This is a text string from a DLL"
end function

public sub AddTxt(psText as string)
dim lsTemp as string

  lsTemp=psText & " Added Text"
  psText=lsTemp
end sub

public function AddNumbers(liNum1 as integer, liNum2 as integer) as integer
  AddNumbers=liNum1+liNum2
end function

Run the project to make sure you have no errors. If no erros then compile into dll.

Start a new Standard EXE project in VB5.

Rename Project1 to ProjMain

Under Project references select ProjTest

Place 3 texboxes on the form called txtTest1, txtTest2, txtTest3.
Place 3 commandbuttons on the form called cmdTest1, cmdTest2, cmdTest3.

Place the following code in the forms code window.

Option Explicit

Private cTest As cTest

Private Sub cmdTest1_Click()
  txtTest1 = cTest.ReturnTxt
End Sub

Private Sub cmdTest2_Click()
Dim lsTemp As String
  lsTemp = txtTest2.Text
  Call cTest.AddTxt(lsTemp)
  txtTest2 = lsTemp
End Sub

Private Sub cmdTest3_Click()
  txtTest3 = cTest.AddNumbers(2, 4)
End Sub

Private Sub Form_Load()
  Set cTest = New cTest
 
  txtTest1 = ""
  txtTest2 = "Original Text"
  txtTest3 = ""
  cmdTest1.Caption = "ReturnTxt"
  cmdTest2.Caption = "AddText"
  cmdTest3.Caption = "AddNum"
End Sub

0
 

Author Comment

by:cwrjr
ID: 1447364
Thank you
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question