win 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/lib/win/dde.rb +109 -15
  3. data/spec/win/dde_spec.rb +9 -1
  4. data/win.gemspec +1 -1
  5. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.13
data/lib/win/dde.rb CHANGED
@@ -62,6 +62,36 @@ module Win
62
62
  XTYP_MASK = 0x00F0
63
63
  XTYP_SHIFT = 0x0004
64
64
 
65
+ # Types Hash {TRANSACTION_TYPE=>'Type description')}
66
+ TYPES = {
67
+ XTYPF_NOBLOCK => 'XTYPF_NOBLOCK',
68
+ XTYPF_NODATA => 'XTYPF_NODATA',
69
+ XTYPF_ACKREQ => 'XTYPF_ACKREQ',
70
+ XCLASS_MASK => 'XCLASS_MASK',
71
+ XCLASS_BOOL => 'XCLASS_BOOL',
72
+ XCLASS_DATA => 'XCLASS_DATA',
73
+ XCLASS_FLAGS => 'XCLASS_FLAGS',
74
+ XCLASS_NOTIFICATION => 'XCLASS_NOTIFICATION',
75
+ XTYP_ERROR => 'XTYP_ERROR',
76
+ XTYP_ADVDATA => 'XTYP_ADVDATA',
77
+ XTYP_ADVREQ => 'XTYP_ADVREQ',
78
+ XTYP_ADVSTART => 'XTYP_ADVSTART',
79
+ XTYP_ADVSTOP => 'XTYP_ADVSTOP',
80
+ XTYP_EXECUTE => 'XTYP_EXECUTE',
81
+ XTYP_CONNECT => 'XTYP_CONNECT',
82
+ XTYP_CONNECT_CONFIRM=> 'XTYP_CONNECT_CONFIRM',
83
+ XTYP_XACT_COMPLETE => 'XTYP_XACT_COMPLETE',
84
+ XTYP_POKE => 'XTYP_POKE',
85
+ XTYP_REGISTER => 'XTYP_REGISTER',
86
+ XTYP_REQUEST => 'XTYP_REQUEST',
87
+ XTYP_DISCONNECT => 'XTYP_DISCONNECT',
88
+ XTYP_UNREGISTER => 'XTYP_UNREGISTER',
89
+ XTYP_WILDCONNECT => 'XTYP_WILDCONNECT',
90
+ XTYP_MONITOR => 'XTYP_MONITOR',
91
+ XTYP_MASK => 'XTYP_MASK',
92
+ XTYP_SHIFT => 'XTYP_SHIFT'
93
+ }
94
+
65
95
  # Transaction confirmations:
66
96
 
67
97
  # Transaction confirmation
@@ -147,6 +177,36 @@ module Win
147
177
  # ?
148
178
  MF_MASK = 0xFF000000
149
179
 
180
+ # Flags Hash {FLAG=>'Flag description')}
181
+ FLAGS = {
182
+ APPCLASS_STANDARD => 'APPCLASS_STANDARD',
183
+ APPCLASS_MONITOR => 'APPCLASS_MONITOR',
184
+ APPCLASS_MASK => 'APPCLASS_MASK',
185
+ APPCMD_CLIENTONLY => 'APPCMD_CLIENTONLY',
186
+ APPCMD_FILTERINITS => 'APPCMD_FILTERINITS',
187
+ APPCMD_MASK => 'APPCMD_MASK',
188
+ CBF_FAIL_SELFCONNECTIONS => 'CBF_FAIL_SELFCONNECTIONS',
189
+ CBF_FAIL_CONNECTIONS => 'CBF_FAIL_CONNECTIONS',
190
+ CBF_FAIL_ADVISES => 'CBF_FAIL_ADVISES',
191
+ CBF_FAIL_EXECUTES => 'CBF_FAIL_EXECUTES',
192
+ CBF_FAIL_POKES => 'CBF_FAIL_POKES',
193
+ CBF_FAIL_REQUESTS => 'CBF_FAIL_REQUESTS',
194
+ CBF_FAIL_ALLSVRXACTIONS => 'CBF_FAIL_ALLSVRXACTIONS',
195
+ CBF_SKIP_CONNECT_CONFIRMS => 'CBF_SKIP_CONNECT_CONFIRMS',
196
+ CBF_SKIP_REGISTRATIONS => 'CBF_SKIP_REGISTRATIONS',
197
+ CBF_SKIP_UNREGISTRATIONS => 'CBF_SKIP_UNREGISTRATIONS',
198
+ CBF_SKIP_DISCONNECTS => 'CBF_SKIP_DISCONNECTS',
199
+ CBF_SKIP_ALLNOTIFICATIONS => 'CBF_SKIP_ALLNOTIFICATIONS',
200
+ MF_HSZ_INFO => 'MF_HSZ_INFO',
201
+ MF_SENDMSGS => 'MF_SENDMSGS',
202
+ MF_POSTMSGS => 'MF_POSTMSGS',
203
+ MF_CALLBACKS => 'MF_CALLBACKS',
204
+ MF_ERRORS => 'MF_ERRORS',
205
+ MF_LINKS => 'MF_LINKS',
206
+ MF_CONV => 'MF_CONV',
207
+ MF_MASK => 'MF_MASK'
208
+ }
209
+
150
210
  # Error codes:
151
211
 
152
212
  # Returned if DDE Init successful
@@ -176,32 +236,36 @@ module Win
176
236
  # - The application used a freed data handle or string handle.
177
237
  # - More than one instance of the application used the same object.
178
238
  DMLERR_INVALIDPARAMETER = 0x4006
179
- # DMLERR_LOW_MEMORY A DDEML application has created a prolonged race condition (in which the server application outruns the client), causing large amounts of memory to be consumed.
239
+ # A DDEML application has created a prolonged race condition (in which the server application
240
+ # outruns the client), causing large amounts of memory to be consumed.
180
241
  DMLERR_LOW_MEMORY = 0x4007
181
- # DMLERR_MEMORY_ERROR A memory allocation has failed.
242
+ # A memory allocation has failed.
182
243
  DMLERR_MEMORY_ERROR = 0x4008
183
- # DMLERR_NOTPROCESSED A transaction has failed.
244
+ # A transaction has failed.
184
245
  DMLERR_NOTPROCESSED = 0x4009
185
- # DMLERR_NO_CONV_ESTABLISHED A client's attempt to establish a conversation has failed.
246
+ # A client's attempt to establish a conversation has failed.
186
247
  DMLERR_NO_CONV_ESTABLISHED = 0x400a
187
- # DMLERR_POKEACKTIMEOUT A request for a synchronous poke transaction has timed out.
248
+ # A request for a synchronous poke transaction has timed out.
188
249
  DMLERR_POKEACKTIMEOUT = 0x400b
189
- # DMLERR_POSTMSG_FAILED An internal call to the PostMessage function has failed.
250
+ # An internal call to the PostMessage function has failed.
190
251
  DMLERR_POSTMSG_FAILED = 0x400c
191
- # DMLERR_REENTRANCY An application instance with a synchronous transaction already in progress attempted to initiate another synchronous transaction, or the DdeEnableCallback function was called from within a DDEML callback function.
252
+ # An application instance with a synchronous transaction already in progress attempted to initiate another
253
+ # synchronous transaction, or the DdeEnableCallback function was called from within a DDEML callback function.
192
254
  DMLERR_REENTRANCY = 0x400d
193
- # DMLERR_SERVER_DIED A server-side transaction was attempted on a conversation terminated by the client, or the server terminated before completing a transaction.
255
+ # A server-side transaction was attempted on a conversation terminated by the client, or the server terminated
256
+ # before completing a transaction.
194
257
  DMLERR_SERVER_DIED = 0x400e
195
- # DMLERR_SYS_ERROR An internal error has occurred in the DDEML.
258
+ # An internal error has occurred in the DDEML.
196
259
  DMLERR_SYS_ERROR = 0x400f
197
- # DMLERR_UNADVACKTIMEOUT A request to end an advise transaction has timed out.
260
+ # A request to end an advise transaction has timed out.
198
261
  DMLERR_UNADVACKTIMEOUT = 0x4010
199
- # DMLERR_UNFOUND_QUEUE_ID An invalid transaction identifier was passed to a DDEML function. Once the application has returned from an XTYP_XACT_COMPLETE callback, the transaction identifier for that callback function is no longer valid.
262
+ # An invalid transaction identifier was passed to a DDEML function. Once the application has returned from an
263
+ # XTYP_XACT_COMPLETE callback, the transaction identifier for that callback function is no longer valid.
200
264
  DMLERR_UNFOUND_QUEUE_ID = 0x4011
201
265
  # Last (highest) error code
202
266
  DMLERR_LAST = DMLERR_UNFOUND_QUEUE_ID
203
267
 
204
- # Hash {ERROR_CODE=>'Error description')}
268
+ # Errors Hash {ERROR_CODE=>'Error description')}
205
269
  ERRORS = {
206
270
  DMLERR_ADVACKTIMEOUT => 'A request for a synchronous advise transaction has timed out.',
207
271
  DMLERR_BUSY => 'The response to the transaction caused the DDE_FBUSY flag to be set.',
@@ -643,7 +707,7 @@ module Win
643
707
  # - DMLERR_NO_CONV_ESTABLISHED
644
708
  # - DMLERR_NO_ERROR
645
709
  # ---
646
- # <b> Enhanced (snake_case) API makes all args optional except for first (dde instance id), and returns nil if
710
+ # <b>Enhanced (snake_case) API makes all args optional except for first (dde instance id), and returns nil if
647
711
  # the function was unsuccessful.</b>
648
712
  # ---
649
713
  # *Remarks*
@@ -656,12 +720,39 @@ module Win
656
720
  # whether the ANSI or Unicode version of the DdeInitialize function was called by the client application.
657
721
  #
658
722
  # :call-seq:
659
- # conversation_handle = dde_connect( instance_id, [service = nil, topic = nil, context = nil] )
723
+ # conversation_handle = dde_connect( instance_id, [service = 0, topic = 0, context = nil] )
660
724
  #
661
725
  function :DdeConnect, [:uint32, :ulong, :ulong, :pointer], :ulong, zeronil: true,
662
- &->(api, instance_id, service = nil, topic = nil, context = nil){
726
+ &->(api, instance_id, service = 0, topic = 0, context = nil){
663
727
  api.call(instance_id, service, topic, context) }
664
728
 
729
+ ##
730
+ # The DdeDisconnect function terminates a conversation started by either the DdeConnect or DdeConnectList function
731
+ # and invalidates the specified conversation handle.
732
+ #
733
+ # [*Syntax*] BOOL DdeDisconnect( HCONV hConv );
734
+ #
735
+ # hConv:: [in, out] Handle to the active conversation to be terminated.
736
+ #
737
+ # *Returns*:: If the function succeeds, the return value is nonzero, otherwise zero. The DdeGetLastError function
738
+ # can be used to get the error code, which can be one of the following values:
739
+ # - DMLERR_DLL_NOT_INITIALIZED
740
+ # - DMLERR_NO_CONV_ESTABLISHED
741
+ # - DMLERR_NO_ERROR
742
+ # ---
743
+ # <b>Enhanced (snake_case) API returns *true/false* instead of nonzero/zero.</b>
744
+ # ---
745
+ # *Remarks*:
746
+ # Any incomplete transactions started before calling DdeDisconnect are immediately abandoned. The XTYP_DISCONNECT
747
+ # transaction is sent to the Dynamic Data Exchange (DDE) callback function of the partner in the conversation.
748
+ # Generally, only client applications must terminate conversations.
749
+ #
750
+ # :call-seq:
751
+ # success = dde_disconnect(conversation_handle)
752
+ #
753
+ function :DdeDisconnect, [:ulong], :int, boolean: true
754
+
755
+
665
756
  ##
666
757
  # The DdeGetLastError function retrieves the most recent error code set by the failure of a Dynamic Data Exchange
667
758
  # Management Library (DDEML) function and resets the error code to DMLERR_NO_ERROR.
@@ -674,6 +765,9 @@ module Win
674
765
  # DMLERR_ADVACKTIMEOUT, DMLERR_EXECACKTIMEOUT, DMLERR_INVALIDPARAMETER, DMLERR_LOW_MEMORY, DMLERR_MEMORY_ERROR,
675
766
  # DMLERR_NO_CONV_ESTABLISHED, DMLERR_NOTPROCESSED, DMLERR_POKEACKTIMEOUT, DMLERR_POSTMSG_FAILED, DMLERR_REENTRANCY,
676
767
  # DMLERR_SERVER_DIED, DMLERR_SYS_ERROR, DMLERR_UNADVACKTIMEOUT, DMLERR_UNFOUND_QUEUE_ID
768
+ # ---
769
+ # <b>Enhanced (snake_case) API returns *nil* if the function was unsuccessful (that is, no DDE errors raised).</b>
770
+ # ---
677
771
  #
678
772
  # :call-seq:
679
773
  # string = dde_get_last_error( instance_id )
data/spec/win/dde_spec.rb CHANGED
@@ -231,9 +231,17 @@ module WinDDETest
231
231
  end
232
232
 
233
233
  describe '#dde_connect' do
234
- it 'connects to existing DDE server'
234
+ spec{ use{ conversation_handle = DdeConnect( instance_id=0, service=0, topic=0, context=nil) }}
235
+ spec{ use{ conversation_handle = dde_connect( instance_id=0, service=0, topic=0, context=nil) }}
236
+ it 'connects to existing DDE server'
235
237
  end
236
238
 
239
+ describe '#dde_disconnect' do
240
+ spec{ use{ success = DdeDisconnect(conversation_handle=0) }}
241
+ spec{ use{ success = dde_disconnect(conversation_handle=0) }}
242
+
243
+ it 'disconnects from existing DDE server'
244
+ end
237
245
  end
238
246
  end
239
247
  end
data/win.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{win}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["arvicco"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - arvicco