CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Newbie question.

    Hiya...
    Im more a visual c programmer..
    but now i need to write some very simple demo to our customers to show them how to use our DLL, which is written in COM.
    I need to know few things please:

    1. How do i use this dll in VB???,i mean how do
    i link it????

    2. The dll is an image processins dll and i need to pass to it an image buffer (the bitmap bits) how do it do it??? lets say i need to load some bmp from the disk and pass it's bits to the dll????

    3. Is there any possebillity that VB5 wont support this dll???? how can i check it????

    Many thanks for any help
    Kishk91



    [email protected]
    ICQ: 13610258

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Newbie question.

    1) To 'link' a dll to VB, you need to do one of two things. Or, you must declare your functions (incase of API's), or you need to add reference to them (this is the case when talking COM). Go to the project menu, and choose references. If your DLL isn't in the list, select browse and select the dll. If all goes well, your dll should be referenced now.
    Now you can use the global funct§ions in that dll, or declare object or types from the dll.

    2) It depends on what type (struct) it is. If the type is in the dll, you can jut declare a variable as that type, fill it, and pass it to the dll. Or if it just uses standard types (like a byte array), you can just use them.

    3) It depends, there are several types that cannot be used in VB, but I can't say which exactly, I think MSDN will have an article on this.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: Newbie question.

    Hi thanks for you reply..
    Usualy, when i load bmp in VC and getting it's bits, im doing it into a BYTE array...
    Dose VB "knows" what BYTE is??? or unsigned char???

    I need to make this DLL as easy as possible to use for our VB users.

    The bitmap bits is the responsebility of the VB programer, i just need to know how which params in VB are paralel in C so ill know to to make the conversions.

    Thanks again
    kishk

    [email protected]
    ICQ: 13610258

  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Newbie question.

    VB knows what BYTE is, so declaring a byte array isn't thar hard

    Dim myByteArray as Byte() ' dynamic byte array



    To pass an array to a C function, you must pass the pointer to the first element of the array. This is done by just passing the first element.

    Call SomeCppFunctionThatTakesAByteArray myByteArray(0) 'pass first element




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: Newbie question.

    Hi again..
    you wrote "To pass an array to a C functio... "

    I suppose this goes for COM too????
    I mean my COM dll should receive a BYTE array.

    Thanks


    [email protected]
    ICQ: 13610258

  6. #6
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Newbie question.

    This also goes for COM

    SomeCppComObject.SomeCppMethodThatTakesAByteArray myByteArray(0)





    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  7. #7
    Join Date
    Jul 2001
    Posts
    3

    Re: Newbie question.

    How does it work out if I have to receive a byte array.


  8. #8
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: Newbie question.

    Hi again...
    just one last question..
    To get the bitmap bits i need to use GetDIBits api??
    or that vb supplies somthing else???

    Thanks
    kishk



    [email protected]
    ICQ: 13610258

  9. #9
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Newbie question.


    Dim bArr() as Byte
    bAyy() = myObject.SomeMethodReturningAByteArray()



    not 100% sure about this

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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