itdoesntwork
itdoesntwork

Reputation: 4802

Reading from keyboard with Ruby

I'm using Windows.

Is there a Ruby Way to make a dll call? I want to use the GetAsyncKeyState() function.

Upvotes: 1

Views: 230

Answers (3)

buruzaemon
buruzaemon

Reputation: 3907

You may want to give FFI a look. It provides a fairly seamless interface to native libraries.

Upvotes: 0

Linuxios
Linuxios

Reputation: 35803

You might want to look at the WIN32OLE library, or the DL library. They are designed for DLL access and Windows programing in Ruby. (NOTE: Although the librarys work, dynamic C access from Ruby does not seem to be an easy task, so use them only for sparse calls to the API. A Win32 program will do better in C, C++, C#, or .NET)

Upvotes: 0

Michael Kohl
Michael Kohl

Reputation: 66837

Haven't been a Windows user in a long time, but there's a Win32API library. Maybe this article helps:

http://www.rubytips.org/2008/05/13/accessing-windows-api-from-ruby-using-win32api-library/

Upvotes: 3

Related Questions