It's a Win32API convention meaning "Window Handle".

Chad

Daniel Carrera wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>What is an "hWnd"?   That's the weirdest variable name I've seen in a 
>while.  I'm sure it makes sense in some that is just not obvious.  It just 
>kind of looks like a random string of characters to me.
>
>
>On Mon, Jun 16, 2003 at 12:15:43AM +0900, Andi Scharfstein wrote:
>  
>
>>Hi,
>>I just got the following to run, maybe someone finds it useful. All it
>>does is extract the songtitle that Winamp is currently playing. Note
>>that of course this only works in a Win32 environment. Also, the
>>constant "4096" and "256" are just values that seemed to work for me.
>>They might yet need correcting.
>>
>>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>
>># Extract Songtitle from Winamp -- 2003 by Andi S.
>>
>>require "Win32API"
>>
>>findWindow = Win32API.new("user32", "FindWindow", ['P', 'P'], 'L')
>>getWindowText = Win32API.new("user32", "GetWindowText", ['L', 'P', 'I'], 'I')
>>hWnd = findWindow.call("Winamp v1.x", 0)
>>
>>if hWnd > 0 then
>>        song_array = " " * 256
>>        getWindowText.call(hWnd, song_array, 4096)
>>        song_array.unpack('M')[0].strip! =~ /^\d+\. (.*) - Winamp.$/
>>        song = $1
>>        puts song
>>
>>        else raise "Please start Winamp first!"
>>end
>>
>>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>
>>-- 
>>Bye: Andi S.                          mailto:nullpointer / myrealbox.com
>>
>>    
>>
>
>- -- 
>Daniel Carrera         | OpenPGP fingerprint:
>Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
>UMD  (301) 405-5137    | http://www.math.umd.edu/~dcarrera/pgp.html
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.2 (SunOS)
>
>iD8DBQE+7I6snxE8DWHf+OcRAgb6AKCkuDk6vT9MQj4HQ2PjbEWr1n0bvACgh7Fk
>1PY6Ey2gop0M0WvJH9lfNUY=
>=JGV4
>-----END PGP SIGNATURE-----
>  
>