annotate ruby/rbdc/examples/win32msgbox.rb @ 52:c5ca08cd3e78

- readme typos
author Tassilo Philipp
date Fri, 22 Jan 2021 15:12:34 +0100
parents 5e159be89d73
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 #//////////////////////////////////////////////////////////////////////
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 # win32msgbox.rb
1
5e159be89d73 - ruby and sh binding updates for dc r0.9
cslag
parents: 0
diff changeset
4 # Copyright 2007-2015 Tassilo Philipp
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 # Dyncall sample loading user32.dll on windows, listing all user32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 # symbols and displaying a # native windows message box by calling
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 # MessageBoxA(...).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 #///////////////////////////////////////////////////////////////////////
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 require 'rbdc'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 l = Dyncall::ExtLib.new
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 if l.load('user32') != nil and l.syms_init('user32')
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 l.syms_each { |s| puts s }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 puts l.syms_count
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 puts l.exists?(:NonExistant)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 puts l.exists?(:MessageBoxA)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 puts l.call(:MessageBoxA, 'IZZI)i', 0, 'Hello world from dyncall!', 'dyncall demo', 0)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 # @@@ check puts on dyncall called function returning a void... crashes e.g. change above signature to IZZI)v
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 end