Bill Kelly
1/4/2006 8:23:00 PM
Hi Mankan,
From: "Beginner" <smankan@ueidaq.com>
>
> You are right, I would like to change the parameter content by passing
> them as pointer(or reference) and I would like to see their values in
> ruby so that based on that value I will be running a for loop.
>
> Like if ruby returns dwtest=3, then next step will be to run a for loop
> for 3 times.
[...]
> require 'Win32API'
> dwtest = "" * 8
> shell1=Win32API.new("my.dll", "myfunc",['P','P','P'],'L')
>
> myfunc takes 3 parameters, &dwerror, &dwnum, &dwtest. Return value is 0
> or 1.
>
> I would like to print or test "&dwtest" which is the 3rd parameter, but
>
> I don't know what mistake am I doing, it never prints the right value.
> I even did "unpack" using dwtest.unpack('L').
How about this:
shell1 = Win32API.new("my.dll", "myfunc",['P','P','P'],'L')
dwerror_ = [0].pack("l")
dwnum_ = [0].pack("l")
dwtest_ = [0].pack("l")
result = shell1.call(dwerror_, dwnum_, dwtest_)
dwerror = dwerror_.unpack("l").first
dwnum = dwnum_.unpack("l").first
dwtest = dwtest_.unpack("l").first
Just a guess...
Hope this helps,
Bill