Windowsでメッセージボックスを出す

win32ore

#!/usr/bin/ruby

require 'win32ole'

wsh = WIN32OLE.new('WScript.Shell')
wsh.Popup("test_msg")


Win32API

#!/usr/bin/ruby

require "Win32API"

class Win32API
  def Win32API.MessageBox(window, text, caption, type = MB_OK)
    messagebox = Win32API.new('user32', 'MessageBox', %w(p p p i), 'i')
    messagebox.call(window, text, caption, type)
  end
end

w_res = Win32API.MessageBox(0, "Are you OK?", "Question", 1 + 32)

if    (w_res == 1)
  w_res = Win32API.MessageBox(0, "OK Click","Answer", 0 + 64)
elsif (w_res == 2)
  w_res = Win32API.MessageBox(0, "Cancel Click", "Answer", 0 + 64)
end