Module: Unknownr::Windows::COM::Helpers
- Defined in:
- lib/unknownr.rb
Instance Method Summary collapse
Instance Method Details
#QueryInstance(klass) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/unknownr.rb', line 125 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
143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/unknownr.rb', line 143 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 |