On Ruby on Windows there´s a fantastic article on Displaying a MessageBox Using the Windows API. This working fine on Ruby 1.8, but unfortunately it is resulting in an error like this when being executed with Ruby 1.9:
message_box.rb:20:in `[]': wrong number of arguments(2 for 1) (ArgumentError)
from message_box.rb:20:in `message_box'
from message_box.rb:25:in `'
Luckily I´ve found a solution on the Ruby-Forum: Ruby 1.9.0 problem with DL.dlopen, in short, replace lines 20 + 21 of the example code by the following:
msgbox = DL::CFunc.new(user32['MessageBoxA'], DL::TYPE_LONG, 'MessageBox')
r, rs = msgbox.call([0, txt, title, 0].pack('L!ppL!').unpack('L!*'))
Eine Antwort auf „Ruby 1.9: Displaying a MessageBox Using the Windows API“
Thank you for your post!