Subject: [ruby-ffi] Re: unable to recreate a pointer |
From: rogerdpack |
Date: 2/26/10 6:43 PM |
To: ruby-ffi |
http://pastie.org/839395 I read in an HWND, attempt to copy it, and use the copy. However, the copy doesn't seem to work.
So it appears the problem is that doing a
(HWND).read_int
isn't allowed by windows at all...
a HANDLE maybe is like a pointer into some deep dark internal
(unreadable, unwritable) windows memory structure.
It's a "special" pointer. It's not what it points to that matters,
but rather that you are pointing to the "right" location.
As a work around you can specify long's for HWND and it works great.
Either that or at least don't try to copy them :)
The only way to copy them (if you're using pointers) is like
new_pointer = FFI::Pointer.new (Top.GetForegroundWindow.address)
Thanks for your patience.
-r