Forum: Ruby windows messagebox example(s)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
02bd6b98b7c04f9ae5868eda3d01fb73?d=identicon&s=25 rtilley (Guest)
on 2006-03-12 04:01
(Received via mailing list)
This is probably documented somewhere, but I thought ruby win32
programmers on the list may find this of use.

require 'Win32API'

def message_box
   # Create a Windows MessageBox.
   # 0 = 'OK' Button
   # 1 = 'OK' 'Cancel' Buttons
   # 2 = 'Abort' 'Retry' 'Ignore' Buttons
   # 3 = 'Yes' 'No' 'Cancel' Buttons
   # 4 = 'Yes' 'No' Buttons
   # 5 = 'Retry' 'Cancel' Buttons
   # 6 = 'Cancel' 'Try Again' 'Continue'
   #######################
   # 16 = 'OK' Button with 'Error' Symbol
   # ... SEE ABOVE EXAMPLES
   # 22 = 'Cancel' 'Try Again' 'Continue' Buttons with 'Error'
   #######################################
   # 32 = 'OK' Button with 'Question' Symbol
   # ... SEE ABOVE EXAMPLES
   # 38 = 'Cancel' 'Try Again' 'Continue' Buttons with 'Question'
   #########################################
   # 48 = 'OK' Button with 'Warning' Symbol
   # ... SEE ABOVE EXAMPLES
   # 54 = 'Cancel' 'Try Again' 'Continue' Buttons with 'Warning'
   ########################################
   # 64 = 'OK' Button with 'Info' Symbol
   # ... SEE ABOVE EXAMPLES
   # 70 = 'Cancel' 'Try Again' 'Continue' Buttons with 'Info'
   ######################################
   mb = Win32API.new("user32", "MessageBox", ['i','p','p','i'], 'i')
   mb.call(0, 'message', "title", 0)
end

x = message_box
A5ae84b6af0a67cdea1db87706a11a6f?d=identicon&s=25 Yoann Guillot (Guest)
on 2006-03-12 10:13
(Received via mailing list)
> This is probably documented somewhere, but I thought ruby win32
> programmers on the list may find this of use.
>
> require 'Win32API'
>
> def message_box
<bunch of constants>
>   mb = Win32API.new("user32", "MessageBox", ['i','p','p','i'], 'i')
>   mb.call(0, 'message', "title", 0)
> end
>
> x = message_box
>

I personnaly prefer using DL::Importable :

require 'dl/import'

module User32
        extend DL::Importable
        dlload 'user32'
        extern 'long MessageBox(long, char*, char*, long)'
end

User32.messageBox(0, 'i love dl', 'hello', 0)
4b1d69e2ac9037081497056f70196369?d=identicon&s=25 Amit Tomar (amit-singh)
on 2010-10-19 15:58
but Gentlemen is there any to show this meassage box on client side??
B2b20140efe14944692ab82a08f9b1c7?d=identicon&s=25 Charles Calvert (Guest)
on 2010-10-21 18:06
(Received via mailing list)
On Tue, 19 Oct 2010 08:58:21 -0500, Amit Tomar <amittomer25@yahoo.com>
wrote in <6bab38be5e342af9b5c376ac98fa2f56@ruby-forum.com>:

>but Gentlemen is there any to show this meassage box on client side??

A couple of things.

1. You're replying to a thread that is over four years old.  My
newsserver happens to have it, and I happened to have it flagged to
watch, but this is generally not a good way to get a question
answered.  You should start a new thread instead.

2. Your question makes no sense.  The discussion was about using the
Win32 API to display a message box.  The Win32 API is the OS API for
32 bit versions of Windows, so it is inherently client-side.
This topic is locked and can not be replied to.