Class: Dde::DdeString

Inherits:
String
  • Object
show all
Includes:
Win::Dde
Defined in:
lib/dde/dde_string.rb

Overview

Class encapsulates DDE string. In addition to normal string behavior, it also has handle that can be passed to dde functions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance_id, string_or_handle, code_page = CP_WINANSI) ⇒ DdeString

Given the DDE application instance_id, you cane create DdeStrings either from regular string or from known DdeString handle



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dde/dde_string.rb', line 15

def initialize(instance_id, string_or_handle, code_page=CP_WINANSI)
  @instance_id = instance_id
  @code_page = code_page

  begin
    if string_or_handle.is_a? String
      @name = string_or_handle
      error unless @handle = dde_create_string_handle(@instance_id, @name, @code_page)
    else
      @handle = string_or_handle
      error unless @name = dde_query_string(@instance_id, @handle, @code_page)
    end
  rescue => e
  end
  raise Dde::Errors::StringError, "Failed to initialize DDE string: #{e} #{e.backtrace.join("\n")}" unless @handle && @name && !e
  super @name
end

Instance Attribute Details

#code_pageObject

string handle passable to DDEML functions



8
9
10
# File 'lib/dde/dde_string.rb', line 8

def code_page
  @code_page
end

#handleObject

string handle passable to DDEML functions



8
9
10
# File 'lib/dde/dde_string.rb', line 8

def handle
  @handle
end

#instance_idObject

string handle passable to DDEML functions



8
9
10
# File 'lib/dde/dde_string.rb', line 8

def instance_id
  @instance_id
end

#nameObject

string handle passable to DDEML functions



8
9
10
# File 'lib/dde/dde_string.rb', line 8

def name
  @name
end