Module: Fzeet::Windows::COM::Helpers
- Defined in:
- lib/fzeet/windows/com/Common.rb
Instance Method Summary collapse
Instance Method Details
#QueryInstance(klass) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/fzeet/windows/com/Common.rb', line 123 def QueryInstance(klass) instance = nil FFI::MemoryPointer.new(:pointer) { |ppv| QueryInterface(klass::IID, ppv) instance = klass.new(ppv.read_pointer) } begin yield instance; return self ensure instance.Release end if block_given? instance end |
#UseInstance(klass, name, *args) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/fzeet/windows/com/Common.rb', line 141 def UseInstance(klass, name, *args) instance = nil FFI::MemoryPointer.new(:pointer) { |ppv| send(name, *args, klass::IID, ppv) yield instance = klass.new(ppv.read_pointer) } self ensure instance.Release if instance end |