1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/dl/sample/msgbox.rb
ttate 7d711b817e Add ruby-dl
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-02 10:56:13 +00:00

19 lines
302 B
Ruby

# 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