Click to See Complete Forum and Search --> : Call own dll.


alexK
October 20th, 1999, 02:55 PM
I was trying to use the dll that is not standart
Win API dll. The function that I try to use
declared as following.

int FileVersion(char *filename)




And here is how I declared it in my VB project

Declare Function D3FileVersion
Lib "d3libshr" (Buffer as string)
as Integer




And here is the error that I got
"Bad DLL calling convention" ERRor 49
Please tell me that doe this error mean.
thks
Alex!

czimmerman
October 20th, 1999, 11:36 PM
I don't think a C charcter pointer translates to a VB string. However, I don't really know what it would translate to. I would try changing "as string" to "as any" and see how that goes.

I think that the best translation for a character pointer is a byte array, so if as any doesn't work, try changing the variable to a byte array.

C experts, help me out here -- I'm just throwing out the hacks I would try, don't know if they'll work.

Charlie Zimmerman
http://www.freevbcode.com


Charlie

Lothar Haensler
October 21st, 1999, 01:40 AM
you should declare the string like this
( byval s as string )
then, in a 32 bit DLL an int is 4 bytes. Thus you should declare the returncode of your function "As Long".

alexK
October 21st, 1999, 11:40 AM
It seams like byVal is the critical thing here.
And although it generate the error it does do the
job it suppose to do. I am trying to see why it
doing that but it works!!!!!!!!!!!
Thks!