Results 1 to 3 of 3

Thread: Creating a DLL - Please Help!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Posts
    135
    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

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Unfortunately, classes and properties don't work the same way in VB and C++. However, you can fake it using structures and global functions

    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 [code] [/code] tags
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Okay...now I've managed to get VC++ working again Damn windoze 98

    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.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width