PDA

Click to See Complete Forum and Search --> : Creating a DLL - Please Help!


Jason B
Mar 10th, 2001, 06:37 PM
Hi... I very new to VC++ but i have been programming in VB for a long time now.. I want to create a dll in Visual C++ to be used in VB. I am writing it in VC because what i want to Code wont work in VB code.. Typical Huh? Anyway.. the structure which i want to write it in is as follows..

***** Code Start Here *****

'local variable(s) to hold property value(s)
Private mvarResponseCode As String 'local copy (Max Length = 2)
Private mvarResponseText As String 'local copy (Max Length = 20)
Private mvarPort As String 'local copy (Max Length = 1)
Private mvarPrintString As String 'local copy (Max Length = MAX_BUFF_SIZE)

Private Function PrinterOnline() As Boolean

End Function

Private Sub PrintData()

End Sub

Public Sub Start()

End Sub

Public Property Let PrintString(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.PrintString = 5
mvarPrintString = vData
End Property

Public Property Get PrintString() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.PrintString
PrintString = mvarPrintString
End Property

Public Property Let Port(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Port = 5
mvarPort = vData
End Property

Public Property Get Port() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Port
Port = mvarPort
End Property

Public Property Get ResponseText() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ResponseText
ResponseText = mvarResponseText
End Property

Public Property Get ResponseCode() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ResponseCode
ResponseCode = mvarResponseCode
End Property

***** Code ENDS Here *****

Could someone please show me how to create a structure in VC++ which is exactly the same as the one i have pasted above..

Thanks Heaps

parksie
Mar 11th, 2001, 01:41 PM
Unfortunately, classes and properties don't work the same way in VB and C++. However, you can fake it using structures and global functions :eek:

If you haven't used C++ before I would suggest learning the language before trying to make DLLs, use the API, etc.

I'll take a look at your problem and get back to you :)

PS: Visual C++ is an IDE and compiler, C++ is the language
PPS: Put code inside tags

parksie
Mar 17th, 2001, 07:32 AM
Okay...now I've managed to get VC++ working again :rolleyes: Damn windoze 98 :mad:

As far as I can see there's no real way of getting it to work in the way you want...what's the code you need that won't work? It'll probably be best to only put that bit into a DLL and run the rest from a VB class.