Subject:
Re: [ruby-ffi] Re: Using Windows Unicode functions
From:
Luis Lavena
Date:
1/27/10 4:58 AM
To:
ruby-ffi@googlegroups.com

On Tue, Jan 26, 2010 at 5:36 PM, Quintus <sutniuq@gmx.net> wrote:
> That works! Thank you! So, here's the working code:
> ------------------------------------
> #Encoding: UTF-8
> require "ffi"
>
> module Test
>  extend FFI::Library
>
>  ffi_lib "user32"
>  ffi_convention :stdcall
>
>  attach_function :message_box, :MessageBoxW,
> [:long, :buffer_in, :buffer_in, :int], :int
> end
>
> string = "Test with umlaut: ä\0".encode("UTF-16LE") #MS expects double
> NUL at a unicode string's end
> Test.message_box(0, string, string, 0)
> ----------------------------------------
> Tested with ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-
> mingw32].
>

Nice!

Can someone ad a stub and details about Unicode Windows to the wiki?

http://wiki.github.com/ffi/ffi/

This indeed is very helpful!

Sorry for not being able to get into this, been very busy and traveling...

-- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exupéry