summaryrefslogtreecommitdiff
path: root/ruby_1_8_6/ext/dl/sample/msgbox2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_1_8_6/ext/dl/sample/msgbox2.rb')
-rw-r--r--ruby_1_8_6/ext/dl/sample/msgbox2.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/ruby_1_8_6/ext/dl/sample/msgbox2.rb b/ruby_1_8_6/ext/dl/sample/msgbox2.rb
new file mode 100644
index 0000000000..e49846cc5e
--- /dev/null
+++ b/ruby_1_8_6/ext/dl/sample/msgbox2.rb
@@ -0,0 +1,18 @@
+# This script works on Windows.
+
+require 'dl/win32'
+
+MB_OK = 0
+MB_OKCANCEL = 1
+
+message_box = Win32API.new("user32",'MessageBoxA', 'ISSI', 'I')
+r = message_box.call(0, 'ok?', 'error', MB_OKCANCEL)
+
+case r
+when 1
+ print("OK!\n")
+when 2
+ print("Cancel!\n")
+else
+ p r
+end