0
|
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
|