[Win32utils-devel] win32-clipboard and change_notify

Heesob Park phasis at gmail.com
Thu Jan 9 15:10:13 UTC 2014


Hi,

2014/1/9 Daniel Berger <djberg96 at gmail.com>:
> Hi,
>
> I'm having a bit of trouble with converting one bit of the change_notify
> code. The first time SetWindowLongPtr is called, it's passed a proc
> (callback). The second time, it's passed an HWND, returned from
> SetClipboardViewer.
>
> I'm not sure how to handle the function declaration or how to pass arguments
> exactly. Is there a way to convert a Ruby proc directly into an FFI pointer?
>
I'm not sure what is your problem.

WNDPROC type is  LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM, LPARAM);

wnd_proc could be translated as FFI::Function
wnd_proc = FFI::Function.new(:void, [:pointer, :long, :long, :long,
:long]) do |hwnd, umsg, wparam, lparam|

end

SetWindowLongPtr(handle, GWL_WNDPROC, wnd_proc.address)


Regards,
Park Heesob


More information about the win32utils-devel mailing list