Click to See Complete Forum and Search --> : Newbie question.
kishk91
July 9th, 2001, 12:17 AM
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
kishk91@hotmail.com
ICQ: 13610258
Cakkie
July 9th, 2001, 12:50 AM
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
slisse@planetinternet.be
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
kishk91
July 9th, 2001, 01:10 AM
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
kishk91@hotmail.com
ICQ: 13610258
Cakkie
July 9th, 2001, 01:17 AM
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
slisse@planetinternet.be
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
kishk91
July 9th, 2001, 01:28 AM
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
kishk91@hotmail.com
ICQ: 13610258
Cakkie
July 9th, 2001, 01:33 AM
This also goes for COM
SomeCppComObject.SomeCppMethodThatTakesAByteArray myByteArray(0)
;)
Tom Cannaerts
slisse@planetinternet.be
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
jindani
July 9th, 2001, 01:24 PM
How does it work out if I have to receive a byte array.
kishk91
July 10th, 2001, 12:13 AM
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
kishk91@hotmail.com
ICQ: 13610258
Cakkie
July 10th, 2001, 12:39 AM
Dim bArr() as Byte
bAyy() = myObject.SomeMethodReturningAByteArray()
not 100% sure about this
Tom Cannaerts
slisse@planetinternet.be
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.