Subject:
Re: [ruby-ffi] Re: unable to recreate a pointer
From:
Wayne Meissner
Date:
2/26/10 9:51 PM
To:
ruby-ffi@googlegroups.com

On 27 February 2010 10:43, rogerdpack <rogerpack2005@gmail.com> wrote:
> 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)

So, the question is, why are you trying to do this at all?

What is the use case where this causes problems?

fg_window = Top.GetForegroundWindow
new_pointer = fg_window