Open a dialog and check the result : Win32API « Windows Platform « Ruby






Open a dialog and check the result

require 'Win32API'

title = "My Application"
text = "Hello, world!"

dialog = Win32API.new('user32', 'MessageBox', 'LPPL', 'I')
result = dialog.call(0, text, title, 1)

case result
  when 1:
    puts "Clicked OK"
  when 2:
    puts "Clicked Cancel"
  else
    puts "Clicked something else!"
end

 








Related examples in the same category

1.Use Win32API to get a pointer a function
2.Read from keyboard
3.Working with Microsoft Windows: open a dialog box:
4.Get cursor position with Win32API