From: "Michael L. Semon" Date: 2001-03-21T07:25:47+09:00 Subject: [ruby-talk:12988] Win32: Wrapper functions? Hi! I've been using Ruby to learn the Win32 API on Windows 98. Along the way, I've found myself writing simple wrapper objects so I don't have to make so many messy declarations. This is an example (trimmed for E-mail): # ---- Win32_Console.rb ---- STD_INPUT_HANDLE = 0xFFFFFFF6 STD_OUTPUT_HANDLE = 0xFFFFFFF5 STD_ERROR_HANDLE = 0xFFFFFFF4 class Win32_Console require 'Win32API' def GetStdHandle( nStdHandle ) a = Win32API.new( "kernel32", "GetStdHandle", ['l'], 'l' ) a.call( nStdHandle ) end def GetConsoleScreenBufferInfo( hConsoleOutput, lpBuffer ) a = Win32API.new( "kernel32", "GetConsoleScreenBufferInfo", ['l', 'p'], 'i' ) a.call( hConsoleOutput, lpBuffer ) end end That way--with the class saved in my current directory--I can call things like this: # ---- test_Console.rb ---- require 'Win32_Console' a = Win32_Console.new() hnd = a.GetStdHandle( STD_OUTPUT_HANDLE ) lpBuffer = ' ' * 22 result = a.GetConsoleScreenBufferInfo( hnd, lpBuffer ) res = lpBuffer.unpack('SSSSSSSSSSS') puts res # and so on, and so forth Because I've been using Ruby for about five days, I'm clueless. Therefore, I'll ask my questions here: 1. Are there already Ruby Win32 API wrapper objects on the Web? If so, where can I find them? 2. If there aren't such objects for download, is there an interest in such a thing? 3. If I exclaimed, "I have a module for everybody to use!" where would be the best place to exclaim it? Thanks in advance for your input, and have fun! Michael