comparison ruby/rbdc/examples/win32msgbox.rb @ 0:0cfcc391201f

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:26:28 +0100
parents
children 5e159be89d73
comparison
equal deleted inserted replaced
-1:000000000000 0:0cfcc391201f
1 #//////////////////////////////////////////////////////////////////////
2 #
3 # win32msgbox.rb
4 # Copyright 2007-2014 Tassilo Philipp
5 #
6 # Dyncall sample loading user32.dll on windows, listing all user32
7 # symbols and displaying a # native windows message box by calling
8 # MessageBoxA(...).
9 #
10 #///////////////////////////////////////////////////////////////////////
11
12 require 'rbdc'
13
14 l = Dyncall::ExtLib.new
15 if l.load('user32') != nil and l.syms_init('user32')
16 l.syms_each { |s| puts s }
17 puts l.syms_count
18 puts l.exists?(:NonExistant)
19 puts l.exists?(:MessageBoxA)
20 puts l.call(:MessageBoxA, 'IZZI)i', 0, 'Hello world from dyncall!', 'dyncall demo', 0)
21 # @@@ check puts on dyncall called function returning a void... crashes e.g. change above signature to IZZI)v
22 end