Subject:
Re: [ruby-ffi] Re: unable to find method?
From:
Luis Lavena
Date:
12/18/09 12:36 PM
To:
ruby-ffi@googlegroups.com

On Fri, Dec 18, 2009 at 3:10 PM, rogerdpack <rogerpack2005@gmail.com> wrote:
>
>> > ref:http://msdn.microsoft.com/en-us/library/ms633499(VS.85).aspx
>>
>> > What might it be...?
>>
>> FindWindow is an alias of FindWindowA or FindWindowW depending if
>> unicode/wide condition was defined prior including the headers.
>>
>> So: there is no FindWindow, as pointed by others on this thread.
>
> Interesting.
>
> Thanks for the help.
>
> C:\>strings \WINDOWS\system32\user32.dll | grep  FindWindow
> FindWindowA
> FindWindowExA
> FindWindowExW
> FindWindowW
>
>
> Any guesses as to how VB is able to accomplish its snippet?
>
> <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
> Public Shared Function FindWindow(ByVal lpClassName As String, ByVal
> lpWindowName As String) As IntPtr
> End Function
>

Magic is in CharSet... Depending in the character encoding NET is
doing the magic of turning String to WideString for you,
transparently.

> Does it add a W or something, for us? (and ffi theoretically could,
> too?)

You're trying to compare apple to oranges.

-- 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