module WindowsCOM::COMInterface_

Public Class Methods

[](vtbl, siid) click to toggle source
# File lib/windows_com/common.rb, line 184
def self.[](vtbl, siid)
        Class.new {
                const_set :Vtbl, vtbl
                const_set :IID, WindowsCOM::GUID[siid]

                def initialize(pointer)
                        @vptr = WindowsCOM::COMVptr_.new(pointer)
                        @vtbl = self.class::Vtbl.new(@vptr[:lpVtbl])
                end

                attr_reader :vptr, :vtbl

                def to_ptr
                        @vptr.pointer
                end

                self::Vtbl.members.each { |name, sig|
                        define_method(name) { |*args|
                                args.unshift(@vptr) # prepend *this* ptr for FFI func call

                                STDERR.puts [:vt_call, self.class, name, args].inspect if
                                        WINDOWS_COM_TRACE_CALL_ARGS

                                @vtbl[name].call(*args)
                        }
                }
        }
end
new(pointer) click to toggle source
# File lib/windows_com/common.rb, line 189
def initialize(pointer)
        @vptr = WindowsCOM::COMVptr_.new(pointer)
        @vtbl = self.class::Vtbl.new(@vptr[:lpVtbl])
end

Public Instance Methods

to_ptr() click to toggle source
# File lib/windows_com/common.rb, line 196
def to_ptr
        @vptr.pointer
end