From 7d711b817e62eb6c8dee01ea2283fcb1ad90f8ac Mon Sep 17 00:00:00 2001 From: ttate Date: Tue, 2 Apr 2002 10:56:13 +0000 Subject: Add ruby-dl git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/sample/msgbox.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ext/dl/sample/msgbox.rb (limited to 'ext/dl/sample/msgbox.rb') diff --git a/ext/dl/sample/msgbox.rb b/ext/dl/sample/msgbox.rb new file mode 100644 index 0000000000..091e646091 --- /dev/null +++ b/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 -- cgit v1.2.3