Page 1 of 1

passing byref to lib proc

Posted: Fri Apr 16, 2010 5:47 pm
by harkon
I'm working on a project where I needed a TWAIN interface. I'm using EZTWAIN. It comes in a .dll and with a static Lib. I've decided, maybe in error, that it was simpler for me to just use the .lib, that way I would not need to add a dependency to the final product.

For several functions the VB call to the .DLL looks like this;

Code: Select all

Declare Sub TWAIN_ReadRow Lib "eztw32.dll" (ByVal hdib As Long, ByVal nRow As Long, ByRef prow As Any)
My PB code looks like this inside of the Import "EZTW32.LIB" / EndImport;

Code: Select all

DIB_ReadRow(hdib.l, nRow.l, prow.??) As "_DIB_ReadRow@12"
Okay, obviously .?? ain't right, so my question is how do I make this work. How do I duplicate the functionality of "ByRef variable As Any"
I have most everything working and it works really well so this is my first stumbling block in making this somewhat complete.

TIA

*EDIT*
The VB call is actually wrong it should not be TWAIN_ReadRow because that function does not exist, it does work as DIB_ReadRow though. It was a typo in their given example.

Re: passing byref to lib proc

Posted: Fri Apr 16, 2010 6:07 pm
by srod
prow.i would seem correct. Just make sure that when you call the function you then pass a suitable address in lieu of this parameter.

Re: passing byref to lib proc

Posted: Fri Apr 16, 2010 6:12 pm
by ts-soft

Code: Select all

DIB_ReadRow(hdib.i, nRow.l, *prow)

Re: passing byref to lib proc

Posted: Fri Apr 16, 2010 6:49 pm
by harkon
Thanks guys, it's way too easy.