dde 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -5
- data/.gitignore +21 -22
- data/LICENSE +20 -20
- data/README.rdoc +19 -19
- data/Rakefile +60 -60
- data/VERSION +1 -1
- data/bin/dde_main +32 -32
- data/dde.gemspec +99 -99
- data/doc/ddeml.d.txt +374 -374
- data/doc/types.txt +159 -159
- data/exp/exp_client.rb +44 -44
- data/exp/exp_dde_monitor.rb +18 -18
- data/exp/exp_dde_server.rb +36 -36
- data/exp/exp_lib.rb +38 -38
- data/exp/exp_server.rb +44 -44
- data/features/dde.feature +9 -9
- data/features/support/env.rb +4 -4
- data/lib/dde.rb +9 -9
- data/lib/dde/app.rb +91 -91
- data/lib/dde/client.rb +102 -102
- data/lib/dde/dde_string.rb +32 -32
- data/lib/dde/monitor.rb +93 -93
- data/lib/dde/server.rb +40 -40
- data/lib/dde/xl_server.rb +89 -89
- data/lib/dde/xl_table.rb +190 -190
- data/spec/dde/app_shared.rb +84 -84
- data/spec/dde/app_spec.rb +7 -7
- data/spec/dde/client_spec.rb +199 -199
- data/spec/dde/dde_string_spec.rb +39 -39
- data/spec/dde/monitor_spec.rb +33 -33
- data/spec/dde/server_shared.rb +91 -91
- data/spec/dde/server_spec.rb +36 -36
- data/spec/dde/xl_server_spec.rb +63 -63
- data/spec/dde/xl_table_spec.rb +50 -50
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +21 -25
- metadata +35 -18
data/doc/types.txt
CHANGED
@@ -1,159 +1,159 @@
|
|
1
|
-
== Parameters ( win32-api )
|
2
|
-
Long: 'L'
|
3
|
-
Integer: 'I'
|
4
|
-
Pointer: 'P'
|
5
|
-
Void: 'V'
|
6
|
-
String: 'S'
|
7
|
-
Callback: 'K' # win32-api only
|
8
|
-
|
9
|
-
== Windows Data Types
|
10
|
-
BOOL => 'I' (or 'B', win32-api only)
|
11
|
-
DWORD => 'L'
|
12
|
-
HANDLE => 'L'
|
13
|
-
LPDWORD => 'P' (or 'L')
|
14
|
-
LPTSTR => 'P'
|
15
|
-
LPCTSTR => 'S'
|
16
|
-
UINT => 'L'
|
17
|
-
VOID => 'V'
|
18
|
-
WORD => 'I'
|
19
|
-
LPVOID => 'L' (or 'P')
|
20
|
-
CALLBACK => 'K'
|
21
|
-
|
22
|
-
== C Data Types
|
23
|
-
void => 'V'
|
24
|
-
void* => 'P'
|
25
|
-
char* => 'P'
|
26
|
-
const char* => 'L'
|
27
|
-
int => 'I'
|
28
|
-
long => 'L'
|
29
|
-
struct => 'P'
|
30
|
-
struct* => 'P'
|
31
|
-
|
32
|
-
== Notes
|
33
|
-
In practice most LPVOID types should be designated as 'L' because this
|
34
|
-
usually means the function is looking for an address. Check the documentation
|
35
|
-
for details.
|
36
|
-
|
37
|
-
If using the windows-api library, you can use 'B' instead of 'I' for the return
|
38
|
-
type for functions that return a BOOL.
|
39
|
-
|
40
|
-
===== Definitions from windows-api (api.rb)
|
41
|
-
# Verbose data types that can be used instead of single letters
|
42
|
-
DATA_TYPES = {
|
43
|
-
'ATOM' => 'I',
|
44
|
-
'BOOL' => 'B',
|
45
|
-
'BOOLEAN' => 'B',
|
46
|
-
'BYTE' => 'I',
|
47
|
-
'CALLBACK' => 'K',
|
48
|
-
'CHAR' => 'I',
|
49
|
-
'COLORREF' => 'L',
|
50
|
-
'DWORD' => 'L',
|
51
|
-
'DWORDLONG' => 'L',
|
52
|
-
'DWORD_PTR' => 'P',
|
53
|
-
'DWORD32' => 'I',
|
54
|
-
'DWORD64' => 'L',
|
55
|
-
'HACCEL' => 'L',
|
56
|
-
'HANDLE' => 'L',
|
57
|
-
'HBITMAP' => 'L',
|
58
|
-
'HBRUSH' => 'L',
|
59
|
-
'HCOLORSPACE' => 'L',
|
60
|
-
'HCONV' => 'L',
|
61
|
-
'HDC' => 'L',
|
62
|
-
'HFILE' => 'I',
|
63
|
-
'HKEY' => 'L',
|
64
|
-
'HFONT' => 'L',
|
65
|
-
'HINSTANCE' => 'L',
|
66
|
-
'HKEY' => 'L',
|
67
|
-
'HLOCAL' => 'L',
|
68
|
-
'HMENU' => 'L',
|
69
|
-
'HMODULE' => 'L',
|
70
|
-
'HRESULT' => 'L',
|
71
|
-
'HWND' => 'L',
|
72
|
-
'INT' => 'I',
|
73
|
-
'INT_PTR' => 'P',
|
74
|
-
'INT32' => 'I',
|
75
|
-
'INT64' => 'L',
|
76
|
-
'LANGID' => 'I',
|
77
|
-
'LCID' => 'L',
|
78
|
-
'LCTYPE' => 'L',
|
79
|
-
'LONG' => 'L',
|
80
|
-
'LONGLONG' => 'L',
|
81
|
-
'LONG_PTR' => 'P',
|
82
|
-
'LONG32' => 'L',
|
83
|
-
'LONG64' => 'L',
|
84
|
-
'LPARAM' => 'P',
|
85
|
-
'LPBOOL' => 'P',
|
86
|
-
'LPBYTE' => 'P',
|
87
|
-
'LPCOLORREF' => 'P',
|
88
|
-
'LPCSTR' => 'P',
|
89
|
-
'LPCTSTR' => 'P',
|
90
|
-
'LPCVOID' => 'L',
|
91
|
-
'LPCWSTR' => 'P',
|
92
|
-
'LPDWORD' => 'P',
|
93
|
-
'LPHANDLE' => 'P',
|
94
|
-
'LPINT' => 'P',
|
95
|
-
'LPLONG' => 'P',
|
96
|
-
'LPSTR' => 'P',
|
97
|
-
'LPTSTR' => 'P',
|
98
|
-
'LPVOID' => 'L',
|
99
|
-
'LPWORD' => 'P',
|
100
|
-
'LPWSTR' => 'P',
|
101
|
-
'LRESULT' => 'P',
|
102
|
-
'PBOOL' => 'P',
|
103
|
-
'PBOOLEAN' => 'P',
|
104
|
-
'PBYTE' => 'P',
|
105
|
-
'PHKEY' => 'P',
|
106
|
-
'SC_HANDLE' => 'L',
|
107
|
-
'SC_LOCK' => 'L',
|
108
|
-
'SERVICE_STATUS_HANDLE' => 'L',
|
109
|
-
'SHORT' => 'I',
|
110
|
-
'SIZE_T' => 'P',
|
111
|
-
'TCHAR' => 'L',
|
112
|
-
'UINT' => 'I',
|
113
|
-
'UINT_PTR' => 'P',
|
114
|
-
'UINT32' => 'I',
|
115
|
-
'UINT64' => 'L',
|
116
|
-
'ULONG' => 'L',
|
117
|
-
'ULONGLONG' => 'L',
|
118
|
-
'ULONG_PTR' => 'P',
|
119
|
-
'ULONG32' => 'L',
|
120
|
-
'ULONG64' => 'L',
|
121
|
-
'USHORT' => 'I',
|
122
|
-
'USN' => 'L',
|
123
|
-
'WINAPI' => 'L',
|
124
|
-
'WORD' => 'I'
|
125
|
-
}
|
126
|
-
|
127
|
-
Win::Library shortcuts (Mostly in line with Array#pack)
|
128
|
-
TYPES = {
|
129
|
-
V: :void, # For functions that return nothing (return type void).
|
130
|
-
v: :void, # For functions that return nothing (return type void).
|
131
|
-
C: :uchar, #– 8-bit unsigned character (byte)
|
132
|
-
c: :char, # 8-bit character (byte)
|
133
|
-
# :int8 – 8-bit signed integer
|
134
|
-
# :uint8 – 8-bit unsigned integer
|
135
|
-
S: :ushort, # – 16-bit unsigned integer (Win32API: used for string)
|
136
|
-
s: :short, # – 16-bit signed integer
|
137
|
-
# :uint16 – 16-bit unsigned integer
|
138
|
-
# :int16 – 16-bit signed integer
|
139
|
-
I: :uint, # 32-bit unsigned integer
|
140
|
-
i: :int, # 32-bit signed integer
|
141
|
-
# :uint32 – 32-bit unsigned integer
|
142
|
-
# :int32 – 32-bit signed integer
|
143
|
-
L: :ulong, # unsigned long int – platform-specific size
|
144
|
-
l: :long, # long int – platform-specific size (http://groups.google.com/group/ruby-ffi/browse_thread/thread/4762fc77130339b1)
|
145
|
-
# :int64 – 64-bit signed integer
|
146
|
-
# :uint64 – 64-bit unsigned integer
|
147
|
-
# :long_long – 64-bit signed integer
|
148
|
-
# :ulong_long – 64-bit unsigned integer
|
149
|
-
F: :float, # 32-bit floating point
|
150
|
-
D: :double, # 64-bit floating point (double-precision)
|
151
|
-
P: :pointer, # pointer – platform-specific size
|
152
|
-
p: :string, # C-style (NULL-terminated) character string (Win32API: S)
|
153
|
-
B: :bool # (?? 1 byte in C++)
|
154
|
-
#For function argument type only:
|
155
|
-
# :buffer_in – Similar to :pointer, but optimized for Buffers that the function can only read (not write).
|
156
|
-
# :buffer_out – Similar to :pointer, but optimized for Buffers that the function can only write (not read).
|
157
|
-
# :buffer_inout – Similar to :pointer, but may be optimized for Buffers.
|
158
|
-
# :varargs – Variable arguments
|
159
|
-
}
|
1
|
+
== Parameters ( win32-api )
|
2
|
+
Long: 'L'
|
3
|
+
Integer: 'I'
|
4
|
+
Pointer: 'P'
|
5
|
+
Void: 'V'
|
6
|
+
String: 'S'
|
7
|
+
Callback: 'K' # win32-api only
|
8
|
+
|
9
|
+
== Windows Data Types
|
10
|
+
BOOL => 'I' (or 'B', win32-api only)
|
11
|
+
DWORD => 'L'
|
12
|
+
HANDLE => 'L'
|
13
|
+
LPDWORD => 'P' (or 'L')
|
14
|
+
LPTSTR => 'P'
|
15
|
+
LPCTSTR => 'S'
|
16
|
+
UINT => 'L'
|
17
|
+
VOID => 'V'
|
18
|
+
WORD => 'I'
|
19
|
+
LPVOID => 'L' (or 'P')
|
20
|
+
CALLBACK => 'K'
|
21
|
+
|
22
|
+
== C Data Types
|
23
|
+
void => 'V'
|
24
|
+
void* => 'P'
|
25
|
+
char* => 'P'
|
26
|
+
const char* => 'L'
|
27
|
+
int => 'I'
|
28
|
+
long => 'L'
|
29
|
+
struct => 'P'
|
30
|
+
struct* => 'P'
|
31
|
+
|
32
|
+
== Notes
|
33
|
+
In practice most LPVOID types should be designated as 'L' because this
|
34
|
+
usually means the function is looking for an address. Check the documentation
|
35
|
+
for details.
|
36
|
+
|
37
|
+
If using the windows-api library, you can use 'B' instead of 'I' for the return
|
38
|
+
type for functions that return a BOOL.
|
39
|
+
|
40
|
+
===== Definitions from windows-api (api.rb)
|
41
|
+
# Verbose data types that can be used instead of single letters
|
42
|
+
DATA_TYPES = {
|
43
|
+
'ATOM' => 'I',
|
44
|
+
'BOOL' => 'B',
|
45
|
+
'BOOLEAN' => 'B',
|
46
|
+
'BYTE' => 'I',
|
47
|
+
'CALLBACK' => 'K',
|
48
|
+
'CHAR' => 'I',
|
49
|
+
'COLORREF' => 'L',
|
50
|
+
'DWORD' => 'L',
|
51
|
+
'DWORDLONG' => 'L',
|
52
|
+
'DWORD_PTR' => 'P',
|
53
|
+
'DWORD32' => 'I',
|
54
|
+
'DWORD64' => 'L',
|
55
|
+
'HACCEL' => 'L',
|
56
|
+
'HANDLE' => 'L',
|
57
|
+
'HBITMAP' => 'L',
|
58
|
+
'HBRUSH' => 'L',
|
59
|
+
'HCOLORSPACE' => 'L',
|
60
|
+
'HCONV' => 'L',
|
61
|
+
'HDC' => 'L',
|
62
|
+
'HFILE' => 'I',
|
63
|
+
'HKEY' => 'L',
|
64
|
+
'HFONT' => 'L',
|
65
|
+
'HINSTANCE' => 'L',
|
66
|
+
'HKEY' => 'L',
|
67
|
+
'HLOCAL' => 'L',
|
68
|
+
'HMENU' => 'L',
|
69
|
+
'HMODULE' => 'L',
|
70
|
+
'HRESULT' => 'L',
|
71
|
+
'HWND' => 'L',
|
72
|
+
'INT' => 'I',
|
73
|
+
'INT_PTR' => 'P',
|
74
|
+
'INT32' => 'I',
|
75
|
+
'INT64' => 'L',
|
76
|
+
'LANGID' => 'I',
|
77
|
+
'LCID' => 'L',
|
78
|
+
'LCTYPE' => 'L',
|
79
|
+
'LONG' => 'L',
|
80
|
+
'LONGLONG' => 'L',
|
81
|
+
'LONG_PTR' => 'P',
|
82
|
+
'LONG32' => 'L',
|
83
|
+
'LONG64' => 'L',
|
84
|
+
'LPARAM' => 'P',
|
85
|
+
'LPBOOL' => 'P',
|
86
|
+
'LPBYTE' => 'P',
|
87
|
+
'LPCOLORREF' => 'P',
|
88
|
+
'LPCSTR' => 'P',
|
89
|
+
'LPCTSTR' => 'P',
|
90
|
+
'LPCVOID' => 'L',
|
91
|
+
'LPCWSTR' => 'P',
|
92
|
+
'LPDWORD' => 'P',
|
93
|
+
'LPHANDLE' => 'P',
|
94
|
+
'LPINT' => 'P',
|
95
|
+
'LPLONG' => 'P',
|
96
|
+
'LPSTR' => 'P',
|
97
|
+
'LPTSTR' => 'P',
|
98
|
+
'LPVOID' => 'L',
|
99
|
+
'LPWORD' => 'P',
|
100
|
+
'LPWSTR' => 'P',
|
101
|
+
'LRESULT' => 'P',
|
102
|
+
'PBOOL' => 'P',
|
103
|
+
'PBOOLEAN' => 'P',
|
104
|
+
'PBYTE' => 'P',
|
105
|
+
'PHKEY' => 'P',
|
106
|
+
'SC_HANDLE' => 'L',
|
107
|
+
'SC_LOCK' => 'L',
|
108
|
+
'SERVICE_STATUS_HANDLE' => 'L',
|
109
|
+
'SHORT' => 'I',
|
110
|
+
'SIZE_T' => 'P',
|
111
|
+
'TCHAR' => 'L',
|
112
|
+
'UINT' => 'I',
|
113
|
+
'UINT_PTR' => 'P',
|
114
|
+
'UINT32' => 'I',
|
115
|
+
'UINT64' => 'L',
|
116
|
+
'ULONG' => 'L',
|
117
|
+
'ULONGLONG' => 'L',
|
118
|
+
'ULONG_PTR' => 'P',
|
119
|
+
'ULONG32' => 'L',
|
120
|
+
'ULONG64' => 'L',
|
121
|
+
'USHORT' => 'I',
|
122
|
+
'USN' => 'L',
|
123
|
+
'WINAPI' => 'L',
|
124
|
+
'WORD' => 'I'
|
125
|
+
}
|
126
|
+
|
127
|
+
Win::Library shortcuts (Mostly in line with Array#pack)
|
128
|
+
TYPES = {
|
129
|
+
V: :void, # For functions that return nothing (return type void).
|
130
|
+
v: :void, # For functions that return nothing (return type void).
|
131
|
+
C: :uchar, #– 8-bit unsigned character (byte)
|
132
|
+
c: :char, # 8-bit character (byte)
|
133
|
+
# :int8 – 8-bit signed integer
|
134
|
+
# :uint8 – 8-bit unsigned integer
|
135
|
+
S: :ushort, # – 16-bit unsigned integer (Win32API: used for string)
|
136
|
+
s: :short, # – 16-bit signed integer
|
137
|
+
# :uint16 – 16-bit unsigned integer
|
138
|
+
# :int16 – 16-bit signed integer
|
139
|
+
I: :uint, # 32-bit unsigned integer
|
140
|
+
i: :int, # 32-bit signed integer
|
141
|
+
# :uint32 – 32-bit unsigned integer
|
142
|
+
# :int32 – 32-bit signed integer
|
143
|
+
L: :ulong, # unsigned long int – platform-specific size
|
144
|
+
l: :long, # long int – platform-specific size (http://groups.google.com/group/ruby-ffi/browse_thread/thread/4762fc77130339b1)
|
145
|
+
# :int64 – 64-bit signed integer
|
146
|
+
# :uint64 – 64-bit unsigned integer
|
147
|
+
# :long_long – 64-bit signed integer
|
148
|
+
# :ulong_long – 64-bit unsigned integer
|
149
|
+
F: :float, # 32-bit floating point
|
150
|
+
D: :double, # 64-bit floating point (double-precision)
|
151
|
+
P: :pointer, # pointer – platform-specific size
|
152
|
+
p: :string, # C-style (NULL-terminated) character string (Win32API: S)
|
153
|
+
B: :bool # (?? 1 byte in C++)
|
154
|
+
#For function argument type only:
|
155
|
+
# :buffer_in – Similar to :pointer, but optimized for Buffers that the function can only read (not write).
|
156
|
+
# :buffer_out – Similar to :pointer, but optimized for Buffers that the function can only write (not read).
|
157
|
+
# :buffer_inout – Similar to :pointer, but may be optimized for Buffers.
|
158
|
+
# :varargs – Variable arguments
|
159
|
+
}
|
data/exp/exp_client.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
# Quick and dirty DDE Client (for experimentation)
|
2
|
-
|
3
|
-
require 'win/gui/message'
|
4
|
-
include Win::GUI::Message
|
5
|
-
|
6
|
-
#require_relative 'exp_lib'
|
7
|
-
#include DDELib
|
8
|
-
|
9
|
-
require 'win/dde'
|
10
|
-
include Win::
|
11
|
-
|
12
|
-
calls = []
|
13
|
-
buffer = FFI::MemoryPointer.new(:long).write_long(0)
|
14
|
-
buffer.address
|
15
|
-
|
16
|
-
callback = lambda do |*args|
|
17
|
-
calls << [*args]
|
18
|
-
DDE_FACK
|
19
|
-
end
|
20
|
-
|
21
|
-
p status = DdeInitialize(buffer, callback, APPCLASS_STANDARD, 0)
|
22
|
-
p id = buffer.read_long
|
23
|
-
|
24
|
-
service = FFI::MemoryPointer.from_string('test_service')
|
25
|
-
|
26
|
-
p handle = DdeCreateStringHandle(id, service, CP_WINANSI)
|
27
|
-
|
28
|
-
p conv_handle = DdeConnect(id, handle, handle, nil)
|
29
|
-
|
30
|
-
str = FFI::MemoryPointer.from_string("Poke_string\n\x00\x00")
|
31
|
-
|
32
|
-
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_POKE, 1000, nil)
|
33
|
-
p Win::
|
34
|
-
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, 1000, nil)
|
35
|
-
p Win::
|
36
|
-
sleep 0.01
|
37
|
-
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, nil)
|
38
|
-
p Win::
|
39
|
-
|
40
|
-
p DdeDisconnect(conv_handle)
|
41
|
-
|
42
|
-
p calls.map{|c| c.map{|e|e.respond_to?(:address) ? e.address : (Win::
|
43
|
-
|
44
|
-
p Win::
|
1
|
+
# Quick and dirty DDE Client (for experimentation)
|
2
|
+
|
3
|
+
require 'win/gui/message'
|
4
|
+
include Win::GUI::Message
|
5
|
+
|
6
|
+
#require_relative 'exp_lib'
|
7
|
+
#include DDELib
|
8
|
+
|
9
|
+
require 'win/dde'
|
10
|
+
include Win::Dde
|
11
|
+
|
12
|
+
calls = []
|
13
|
+
buffer = FFI::MemoryPointer.new(:long).write_long(0)
|
14
|
+
buffer.address
|
15
|
+
|
16
|
+
callback = lambda do |*args|
|
17
|
+
calls << [*args]
|
18
|
+
DDE_FACK
|
19
|
+
end
|
20
|
+
|
21
|
+
p status = DdeInitialize(buffer, callback, APPCLASS_STANDARD, 0)
|
22
|
+
p id = buffer.read_long
|
23
|
+
|
24
|
+
service = FFI::MemoryPointer.from_string('test_service')
|
25
|
+
|
26
|
+
p handle = DdeCreateStringHandle(id, service, CP_WINANSI)
|
27
|
+
|
28
|
+
p conv_handle = DdeConnect(id, handle, handle, nil)
|
29
|
+
|
30
|
+
str = FFI::MemoryPointer.from_string("Poke_string\n\x00\x00")
|
31
|
+
|
32
|
+
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_POKE, 1000, nil)
|
33
|
+
p Win::Dde::ERRORS[DdeGetLastError(id)]
|
34
|
+
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, 1000, nil)
|
35
|
+
p Win::Dde::ERRORS[DdeGetLastError(id)]
|
36
|
+
sleep 0.01
|
37
|
+
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, nil)
|
38
|
+
p Win::Dde::ERRORS[DdeGetLastError(id)]
|
39
|
+
|
40
|
+
p DdeDisconnect(conv_handle)
|
41
|
+
|
42
|
+
p calls.map{|c| c.map{|e|e.respond_to?(:address) ? e.address : (Win::Dde::TYPES[e] || e)}}
|
43
|
+
|
44
|
+
p Win::Dde::ERRORS[DdeGetLastError(id)]
|
data/exp/exp_dde_monitor.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# Objective DDE Server (for experimentation)
|
2
|
-
|
3
|
-
require 'win/gui/message'
|
4
|
-
include Win::GUI::Message
|
5
|
-
|
6
|
-
require 'dde'
|
7
|
-
include Win::
|
8
|
-
|
9
|
-
calls = []
|
10
|
-
$monitor =
|
11
|
-
msg = Msg.new # pointer to Msg FFI struct
|
12
|
-
|
13
|
-
# Starting message loop (necessary for DDE processing)
|
14
|
-
puts "Starting message loop\n"
|
15
|
-
while msg = get_message()
|
16
|
-
translate_message(msg)
|
17
|
-
dispatch_message(msg)
|
18
|
-
end
|
1
|
+
# Objective DDE Server (for experimentation)
|
2
|
+
|
3
|
+
require 'win/gui/message'
|
4
|
+
include Win::GUI::Message
|
5
|
+
|
6
|
+
require 'dde'
|
7
|
+
include Win::Dde
|
8
|
+
|
9
|
+
calls = []
|
10
|
+
$monitor = Dde::Monitor.new
|
11
|
+
msg = Msg.new # pointer to Msg FFI struct
|
12
|
+
|
13
|
+
# Starting message loop (necessary for DDE processing)
|
14
|
+
puts "Starting message loop\n"
|
15
|
+
while msg = get_message()
|
16
|
+
translate_message(msg)
|
17
|
+
dispatch_message(msg)
|
18
|
+
end
|
data/exp/exp_dde_server.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
# Objective DDE Server (for experimentation)
|
2
|
-
|
3
|
-
require 'win/gui/message'
|
4
|
-
include Win::GUI::Message
|
5
|
-
|
6
|
-
require 'dde'
|
7
|
-
include Win::
|
8
|
-
|
9
|
-
calls = []
|
10
|
-
@server =
|
11
|
-
calls << extract_values(*args) #[Win::
|
12
|
-
puts "#{Time.now.strftime('%T.%6N')} #{extract_values(*args)}"
|
13
|
-
args.first == XTYP_CONNECT ? 1 : DDE_FACK
|
14
|
-
end
|
15
|
-
sleep 0.05
|
16
|
-
@server.start_service('test_service')
|
17
|
-
|
18
|
-
def extract_values(type, format, conv, hsz1, hsz2, data, data1, data2)
|
19
|
-
[Win::
|
20
|
-
dde_query_string(@server.id, hsz1),
|
21
|
-
dde_query_string(@server.id, hsz2),
|
22
|
-
data, data1, data2]
|
23
|
-
end
|
24
|
-
|
25
|
-
msg = Msg.new # pointer to Msg FFI struct
|
26
|
-
|
27
|
-
# Starting message loop (necessary for DDE processing)
|
28
|
-
puts "Starting message loop\n"
|
29
|
-
while msg = get_message()
|
30
|
-
translate_message(msg)
|
31
|
-
dispatch_message(msg)
|
32
|
-
end
|
33
|
-
|
34
|
-
p calls.map{|c| c.map{|e|e.respond_to?(:address) ? e.address : (Win::
|
35
|
-
|
36
|
-
p Win::
|
1
|
+
# Objective DDE Server (for experimentation)
|
2
|
+
|
3
|
+
require 'win/gui/message'
|
4
|
+
include Win::GUI::Message
|
5
|
+
|
6
|
+
require 'dde'
|
7
|
+
include Win::Dde
|
8
|
+
|
9
|
+
calls = []
|
10
|
+
@server = Dde::Server.new do |*args|
|
11
|
+
calls << extract_values(*args) #[Win::Dde::TYPES[args.shift]]+args; 1}
|
12
|
+
puts "#{Time.now.strftime('%T.%6N')} #{extract_values(*args)}"
|
13
|
+
args.first == XTYP_CONNECT ? 1 : DDE_FACK
|
14
|
+
end
|
15
|
+
sleep 0.05
|
16
|
+
@server.start_service('test_service')
|
17
|
+
|
18
|
+
def extract_values(type, format, conv, hsz1, hsz2, data, data1, data2)
|
19
|
+
[Win::Dde::TYPES[type], format, conv,
|
20
|
+
dde_query_string(@server.id, hsz1),
|
21
|
+
dde_query_string(@server.id, hsz2),
|
22
|
+
data, data1, data2]
|
23
|
+
end
|
24
|
+
|
25
|
+
msg = Msg.new # pointer to Msg FFI struct
|
26
|
+
|
27
|
+
# Starting message loop (necessary for DDE processing)
|
28
|
+
puts "Starting message loop\n"
|
29
|
+
while msg = get_message()
|
30
|
+
translate_message(msg)
|
31
|
+
dispatch_message(msg)
|
32
|
+
end
|
33
|
+
|
34
|
+
p calls.map{|c| c.map{|e|e.respond_to?(:address) ? e.address : (Win::Dde::TYPES[e] || e)}}
|
35
|
+
|
36
|
+
p Win::Dde::ERRORS[DdeGetLastError(@server.id)]
|