Sha256: 4d8089527173ccd094d34e359fafc331f13af66bcadf5903d6fcee476b05a7aa

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

# Quick and dirty DDE Client (for experimentation)

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

#require_relative 'exp_lib'
#include DDELib

require 'win/dde'
include Win::DDE

calls = []
buffer = FFI::MemoryPointer.new(:long).write_long(0)
buffer.address

callback = lambda do |*args|
  calls << [*args]
  DDE_FACK
end

p status = DdeInitialize(buffer, callback, APPCLASS_STANDARD, 0)
p id = buffer.read_long

service = FFI::MemoryPointer.from_string('test_service')

p handle = DdeCreateStringHandle(id, service, CP_WINANSI)

p conv_handle = DdeConnect(id, handle, handle, nil)

str = FFI::MemoryPointer.from_string("Poke_string\n\x00\x00")

p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_POKE, 1000, nil)
p Win::DDE::ERRORS[DdeGetLastError(id)]
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, 1000, nil)
p Win::DDE::ERRORS[DdeGetLastError(id)]
sleep 0.01
p DdeClientTransaction(str, str.size, conv_handle, handle, CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, nil)
p Win::DDE::ERRORS[DdeGetLastError(id)]

p DdeDisconnect(conv_handle)

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

p Win::DDE::ERRORS[DdeGetLastError(id)]

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dde-0.2.9 exp/exp_client.rb
dde-0.2.8 exp/exp_client.rb