diff options
Diffstat (limited to 'ruby_1_8_6/ext/dl/sample/msgbox.rb')
-rw-r--r-- | ruby_1_8_6/ext/dl/sample/msgbox.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ruby_1_8_6/ext/dl/sample/msgbox.rb b/ruby_1_8_6/ext/dl/sample/msgbox.rb new file mode 100644 index 0000000000..091e646091 --- /dev/null +++ b/ruby_1_8_6/ext/dl/sample/msgbox.rb @@ -0,0 +1,19 @@ +# This script works on Windows. + +require 'dl' + +User32 = DL.dlopen("user32") +Kernel32 = DL.dlopen("kernel32") + +MB_OK = 0 +MB_OKCANCEL = 1 + +message_box = User32['MessageBoxA', 'ILSSI'] +r,rs = message_box.call(0, 'ok?', 'error', MB_OKCANCEL) + +case r +when 1 + print("OK!\n") +when 2 + print("Cancel!\n") +end |