From: "Marvin Gülker" Date: 2009-08-11T22:55:06+09:00 Subject: Re: Use Ruby to create Win executable? Marc Heiler wrote: > I think you might also invoke some basic window GUI components like an > alertbox and similar via ruby only. Yes, on Windows you can use features like the MessageBox() function from the Windows API. There are bindings to the Windows API in Ruby's standard library, but they have been deprecated in Ruby 1.9, so I would recommend you to use a gem here, too. win32-api does a very good job: require "rubygems" #if you're running pre-1.9 require "win32/api" #Values just out of my head, I have no Windows to try at the moment #see MSDN (or Google ;-) ) for the correct values MB_OKCANCEL = 1 MB_ICONERROR = 16 ID_OK = 1 ID_CANCEL = 2 #Retrieve function "MessageBox" from "user32.dll" msgbox = Win32::API.new("MessageBox", 'LPPI', 'I', "user32") #This should display a dialog box with a white-on-red X and two buttons ret = msgbox.call(0, "An error occured. Do you want to continue?", "Error", MB_ICONERROR | MB_OKCANCEL) #The 0 indicates there's no parent window if ret == ID_OK #Continue your operation... elsif ret == ID_CANCEL #Cancel your operation... end Marvin -- Posted via http://www.ruby-forum.com/.