Sha256: 4500ed40b2c259e15d6a049b95a5c1001f7a8365b843da400047d28fecfcef1f

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

# Objective DDE Server (for experimentation)

require 'win/gui/message'
include Win::GUI::Message

require 'dde'
include Win::Dde

calls = []
@server = Dde::Server.new do |*args|
  calls << extract_values(*args)  #[Win::Dde::TYPES[args.shift]]+args; 1}
  puts "#{Time.now.strftime('%T.%6N')} #{extract_values(*args)}"
  args.first == XTYP_CONNECT ? 1 : DDE_FACK
end
sleep 0.05
@server.start_service('test_service')

def extract_values(type, format, conv, hsz1, hsz2, data, data1, data2)
  [Win::Dde::TYPES[type], format, conv,
   dde_query_string(@server.id, hsz1),
   dde_query_string(@server.id, hsz2),
   data, data1, data2]
end

msg = Msg.new  # pointer to Msg FFI struct

# Starting message loop (necessary for DDE processing)
puts "Starting message loop\n"
while msg = get_message()
  translate_message(msg)
  dispatch_message(msg)
end

p calls.map{|c| c.map{|e|e.respond_to?(:address) ? e.address : (Win::Dde::TYPES[e] || e)}}

p Win::Dde::ERRORS[DdeGetLastError(@server.id)]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dde-0.2.11 exp/exp_dde_server.rb