Name

Win32API — Microsoft Windows API access class

Synopsis

Win32API represents functions in Windows DLLs.

Required Library

require ‘Win32API’

Example

require 'Win32API'

getch = Win32API.new("crtdll", "_getch", [], 'L')
puts getch.Call.chr

Class Method

Win32API::new(dll, proc, import, export)

Returns the object representing the Win32API function specified by proc name in dll, which has the signature specified by import and export. import is an array of strings denoting types. export is a type specifying string. Type string is any of the following:

"n"

Number

"l"

Number

"i"

Integer

"p"

Pointer

"v"

Void (export only)

Type strings are case-insensitive.

Instance Methods

call([arg...])
Call([arg...])

Invokes the Win32API function. Arguments must conform the signature specified by Win32API::new.

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.