Hi Mankan,

From: "Beginner" <smankan / ueidaq.com>
>
> That was a great guess...it worked........thank you very much.....but
> could you pls explain what the following statement does:
> 
> How a pointer is treated in ruby..I mean what happens to this statement
> ",['P','P','P'],'L')
> 
> and does these below statement means:
> 
> dwerror_ = [0].pack("l")
> dwnum_   = [0].pack("l")
> dwtest_  = [0].pack("l")
> 
> dwerror = dwerror_.unpack("l").first
> dwnum   = dwnum_.unpack("l").first
> dwtest  = dwtest_.unpack("l").first
> 
> orelse give me some point to ruby documentation, that is fine.

If you have "ri" installed on your system, from a DOS prompt,
try: ri pack
or:  ri unpack

Alternately, goto http://www.ruby-doc.org/core/
and click on the Array class, then on the methods "pack" or 
"unpack".

The code above is packing an integer into a string, as a "long",
in native byte order.  When this string is passed through
Win32API as a 'P'ointer, it's in the representation of the
DWORD reference your DLL code was expecting.  Your DLL code
modifies the DWORD reference, which changes the packed string
in Ruby's memory.  We then unpack that string back into an
integer.

Hope this helps,

Regards,

Bill