On Dec 18, 2006, at 4:46 PM, Jim Dossey wrote:
On 12/18/06, Charles Yeomans <[EMAIL PROTECTED]> wrote:
On Dec 18, 2006, at 4:32 PM, Jim Dossey wrote:
> I have a question about using ByRef in Declares and Function calls.
>
> Say I need to call an OS function using a Declare, and that
> function needs a
> pointer to a 4 byte integer in order to return some value. I would
> call
> this function like this:
>
> Dim i As Integer
> Declare Sub SomeFunc Lib "somelib" (ByRef Data As Integer)
> SomeFunc(i)
>
> The returned value is now in 'i'.
>
> But what happens when this code is in a subroutine that I need to
> call, and
> pass in the integer pointer? Now that code looks ike this:
>
> Sub MyFunc (ByRef i As Integer)
> Declare Sub SomeFunc Lib "somelib" (ByRef Data As Integer)
> SomeFunc(i)
> End Sub
>
> and I call this using
>
> Dim x As Integer
> MyFunc(x)
>
> Now I'm using ByRef twice. So when I call SomeFunc am I going to
> pass a
> pointer to a pointer to 'x'?
Probably. But why would you define a subroutine that takes a
parameter by reference?
Charles Yeomans
Actually, it's not my code. I'm trying to port some Windows VB
code to RB.
The VB code has code similar to this in several places. The
program that
I'm porting is a TAPI interface. The TAPI code in Windows is a
real mess.
Well, okay. Have fun.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>