Results 1 to 13 of 13

Thread: Somehow get an array of UDTs into an activex dll ?

  1. #1

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Somehow get an array of UDTs into an activex dll ?

    Ok.

    I have an activexdll.
    I also have a main application.


    I want to pass an array of udts from the main app into the activex dll.
    The activexdll has the udt declared inside it too.


    I know i could save the info to a file, and pass the filename and let the activexdll load it from there.
    I don't want to do that.

    I don't seem to be allowed to pass the data as I could just inside my own main .exe



    Another idea I've been toying with is passing a pointer and data length to the activexdll, and then perhaps it could use CopyMemory to copy a chunk of memory and somehow populate its udts with the info.


    I'm pulling my hair out at this stage
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  2. #2
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Use a buffer

    Here is a buffer class, you need this class in your client EXE and your DLL...

    Woka

    PS. Just going for a tab, and will be abck in 2 mins and post code on how to use it

    PPS. If you have a UDT in a module say:

    VB Code:
    1. Public Type WoofProps
    2.    PK_ID   As Long
    3.    Bark     As String * 20
    4. End Type
    Then you will also need a UDT for the buffer which is the length of the buffer...this can be found by:
    VB Code:
    1. Dim udtBlah As WoofProps
    2.    MsgBox LenB(udtBlah)/2
    So your buffer UDT would be:
    VB Code:
    1. Public Type WoofData
    2.    Buffer * 22 'the 22 is worked out by LenB(udtBlah)/2 (I worked 22 out in my head, it MAY be wrong, check it)
    3. End Type
    each data type has a different length, so it's advisable to ALWAYS work this length out by using the above formula and not just adding them up in your head

    Back in a sec
    Attached Files Attached Files

  3. #3

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Holy mother of god I'm completely lost
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  4. #4

  5. #5

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Cheers
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    *prod*
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  7. #7
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Here it is

    Just load the UDTDemo group...

    Bugger
    Just realise you wanted to pass the data TO a class, not retrieve it
    Shouldn't be hard to reverse it, instead of assigniong objBuffer.GetStae to a function, just pass it to a sub in the DLL instead...

    Woka
    Attached Files Attached Files

  8. #8

  9. #9

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Hmmmm you're early binding to your dll ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  10. #10

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Just looking at second sample now...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  11. #11

  12. #12

  13. #13

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I'll have a look.
    Can I send you an email ?

    To show you my UDT. I don't know if it would be possible you see...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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