CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Posts
    2

    Linked List from VC++ DLL to VB

    Hi!
    I just joined everyone here after reviewing ALL the DLL postings in hope of finding a solution to my problem to no avail. I'm basically a C++ programmer (limited VB knowledge) with the following problem at hand:

    I have written a C++ DLL that creates a C++ object which in turn generates a dynamic linked list of structs. Each list element (C++ struct) also has 2 linked lists of structs within it. In short, my structs contain ordinal values (strings, ints, longs, etc.), pointers, as well as pointers to other structs.
    I then created matching VB class modules that correspond to all my C++ structs. The VB application succesfully calls the DLL which in turn successfully generates the linked list, but how do I access that data from VB? The problem I'm faced with now is: How can the VB application retrieve the linked list from the DLL? How do I fill the VB class modules with the data generated by the DLL?

    Thanx all!


    "For every complex problem, there is a solution that is simple, neat, and wrong." - H.L. Mencken

  2. #2
    Join Date
    Jun 2001
    Posts
    2

    Re: Linked List from VC++ DLL to VB

    I found a solution. Instead of using VB classes, I used Types. I then read the pointers (longs) memory into the Types using:

    private Declare Sub CopyMemoryRead Lib "kernel32" Alias "RtlMoveMemory" (Destination as Any, byval Source as Long, byval Length as Long)




    I was then able to access the linked list data again using CopyMemoryRead.

    "For every complex problem, there is a solution that is simple, neat, and wrong." - H.L. Mencken

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

Featured