Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start DLL creation? 1

Status
Not open for further replies.

arniec

Programmer
Jul 22, 2003
49
US
I am an experienced VB EXE programmer, but now a client is requesting me to create a program in DLL form and I am lost. I have researched this on the 'net and in books but I'm just not seeing how this process goes.

What I need is a DLL which will just return a simple string of data to the calling app. I can code the getting of the data to put into the string, but I am not sure how to code specifically for a DLL, nor am I sure how to then utilize the custom DLL once written for debugging purposes.

Can anyone give me a starting point where I can see an example of a DLL's code as well as the code calling the DLL? The closest I found was at:


But there seem to be some steps missing as I'm not sure what that author means by Dll_co_common.ClsCommon nor do I have Component Services in my control panel.

Any help would be greatly appreciated.
 
This was good, thank you Zemp, but it doesn't tell me how to actually return data. I have viewed the code in the DLL and the EXE and I see that it works but I have trouble following the path of execution as the code is 100% uncommented. I searched PlanetSourceCode for other DLL examples but did not see anything extremely relevant.

Any other suggestions would again be greatly appreciated.
 
You can create a public class function that will return a value to the calling program, much like a normal function.

Or public class variables that the calling progrom can see and retrieve a value from.

Or pass a variable by Reference and change it directly.

For example
in dll class
Code:
Public Sub TESTER(ByRef pString As String)
   pString = "test complete"
End Sub
Public Function TESTERfunction() As String
   TESTERfunction = "test complete"
End Function

From exe
Code:
Private Sub Command1_Click()
   Dim o As MyDLL.DLLclass
   Dim str As String
   
   str = "Nothing"
   Debug.Print str
   Set o = New MyDLL.DLLclass
   'o.TESTER str   ' change variable
   str = o.TESTERfunction  ' return value from function
   Debug.Print str
End Sub


zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top