Class: WIN32OLE_PARAM

Inherits:
Object
  • Object
show all
Defined in:
lib/win32ole-pr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexObject

Returns the value of attribute index.



4214
4215
4216
# File 'lib/win32ole-pr.rb', line 4214

def index
  @index
end

#method_indexObject

Returns the value of attribute method_index.



4212
4213
4214
# File 'lib/win32ole-pr.rb', line 4212

def method_index
  @method_index
end

#nameObject Also known as: to_s

Returns the value of attribute name.



4213
4214
4215
# File 'lib/win32ole-pr.rb', line 4213

def name
  @name
end

#pTypeInfoObject

Returns the value of attribute pTypeInfo.



4211
4212
4213
# File 'lib/win32ole-pr.rb', line 4211

def pTypeInfo
  @pTypeInfo
end

Instance Method Details

#defaultObject



4341
4342
4343
# File 'lib/win32ole-pr.rb', line 4341

def default
  ole_param_default(@pTypeInfo, @method_index, @index)
end

#input?Boolean

Returns:

  • (Boolean)


4297
4298
4299
# File 'lib/win32ole-pr.rb', line 4297

def input?
  ole_param_flag_mask(@pTypeInfo, @method_index, @index, PARAMFLAG_FIN)
end

#inspectObject



4345
4346
4347
4348
4349
4350
4351
4352
# File 'lib/win32ole-pr.rb', line 4345

def inspect
  detail = self.detail
  defval = self.default
  if defval
    detail << '=' + defval.inspect
  end
  "#<#{self.class}:#{detail}>"
end

#ole_param_default(pTypeInfo, method_index, index) ⇒ Object



4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
# File 'lib/win32ole-pr.rb', line 4313

def ole_param_default(pTypeInfo, method_index, index)
  mask = PARAMFLAG_FOPT|PARAMFLAG_FHASDEFAULT
  defval = nil
  lpVtbl = 0.chr * 4
  table = 0.chr * 88
  memcpy(lpVtbl, pTypeInfo, 4)
  memcpy(table, lpVtbl.unpack('L').first, 88)
  table = table.unpack('L*')
  getTypeAttr = Win32::API::Function.new(table[3], 'PP', 'L')
  getFuncDesc = Win32::API::Function.new(table[5], 'PLP', 'L')
  releaseFuncDesc = Win32::API::Function.new(table[20], 'PP', 'L')
  p = 0.chr * 4
  hr = getFuncDesc.call(pTypeInfo, method_index, p)
  return ret if hr != S_OK
  pFuncDesc = p.unpack('L').first
  funcDesc = 0.chr * 52
  memcpy(funcDesc, pFuncDesc, 52)
  tdesc = 0.chr * 16
  memcpy(tdest, funcDesc[8, 4].unpack('L').first + index*16, 16)
  if (tdesc[12, 2].unpack('S').first & mask) == mask
    pParamDescEx = 0.chr * 24
    memcpy(pParamDescEx, tdesc[8, 4].unpack('L').first, 24)
    defval = WIN32OLE.ole_variant2val(pParamDescEx[8, 16])
  end
  releaseFuncDesc.call(pTypeInfo, pFuncDesc)
  defval
end

#ole_param_flag_mask(pTypeInfo, method_index, index, mask) ⇒ Object



4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
# File 'lib/win32ole-pr.rb', line 4272

def ole_param_flag_mask(pTypeInfo, method_index, index, mask)
  ret = false
  lpVtbl = 0.chr * 4
  table = 0.chr * 88
  memcpy(lpVtbl, pTypeInfo, 4)
  memcpy(table, lpVtbl.unpack('L').first, 88)
  table = table.unpack('L*')
  getTypeAttr = Win32::API::Function.new(table[3], 'PP', 'L')
  getFuncDesc = Win32::API::Function.new(table[5], 'PLP', 'L')
  releaseFuncDesc = Win32::API::Function.new(table[20], 'PP', 'L')
  p = 0.chr * 4
  hr = getFuncDesc.call(pTypeInfo, method_index, p)
  return ret if hr != S_OK
  pFuncDesc = p.unpack('L').first
  funcDesc = 0.chr * 52
  memcpy(funcDesc, pFuncDesc, 52)
  tdesc = 0.chr * 16
  memcpy(tdesc, funcDesc[8, 4].unpack('L').first + index*16, 16)
  if (tdesc[12, 2].unpack('S').first & mask) != 0
    ret = true
  end
  releaseFuncDesc.call(pTypeInfo, pFuncDesc)
  ret
end

#ole_param_ole_type(pTypeInfo, method_index, index) ⇒ Object



4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
# File 'lib/win32ole-pr.rb', line 4218

def ole_param_ole_type(pTypeInfo, method_index, index)
  type = "unknown type"
  lpVtbl = 0.chr * 4
  table = 0.chr * 88
  memcpy(lpVtbl, pTypeInfo, 4)
  memcpy(table, lpVtbl.unpack('L').first, 88)
  table = table.unpack('L*')
  getTypeAttr = Win32::API::Function.new(table[3], 'PP', 'L')
  getFuncDesc = Win32::API::Function.new(table[5], 'PLP', 'L')
  releaseFuncDesc = Win32::API::Function.new(table[20], 'PP', 'L')
  p = 0.chr * 4
  hr = getFuncDesc.call(pTypeInfo, method_index, p)
  return type if hr != S_OK
  pFuncDesc = p.unpack('L').first
  funcDesc = 0.chr * 52
  memcpy(funcDesc, pFuncDesc, 52)
  tdesc = 0.chr * 16
  memcpy(tdesc, funcDesc[8, 4].unpack('L').first + index*16, 16)
  type = WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo, tdesc, nil)
  releaseFuncDesc.call(pTypeInfo, pFuncDesc)
  type
end

#ole_param_ole_type_detail(pTypeInfo, method_index, index) ⇒ Object



4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
# File 'lib/win32ole-pr.rb', line 4245

def ole_param_ole_type_detail(pTypeInfo, method_index, index)
  typedetail = []
  lpVtbl = 0.chr * 4
  table = 0.chr * 88
  memcpy(lpVtbl, pTypeInfo, 4)
  memcpy(table, lpVtbl.unpack('L').first, 88)
  table = table.unpack('L*')
  getTypeAttr = Win32::API::Function.new(table[3], 'PP', 'L')
  getFuncDesc = Win32::API::Function.new(table[5], 'PLP', 'L')
  releaseFuncDesc = Win32::API::Function.new(table[20], 'PP', 'L')
  p = 0.chr * 4
  hr = getFuncDesc.call(pTypeInfo, method_index, p)
  return typedetail if hr != S_OK
  pFuncDesc = p.unpack('L').first
  funcDesc = 0.chr * 52
  memcpy(funcDesc, pFuncDesc, 52)
  tdesc = 0.chr * 16
  memcpy(tdesc, funcDesc[8, 4].unpack('L').first + index*16, 16)
  WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo, tdesc, typedetail)
  releaseFuncDesc.call(pTypeInfo, pFuncDesc)
  typedetail
end

#ole_typeObject



4241
4242
4243
# File 'lib/win32ole-pr.rb', line 4241

def ole_type
  ole_param_ole_type(@pTypeInfo, @method_index, @index)
end

#ole_type_detailObject



4268
4269
4270
# File 'lib/win32ole-pr.rb', line 4268

def ole_type_detail
  ole_param_ole_type_detail(@pTypeInfo, @method_index, @index)
end

#optional?Boolean

Returns:

  • (Boolean)


4305
4306
4307
# File 'lib/win32ole-pr.rb', line 4305

def optional?
  ole_param_flag_mask(@pTypeInfo, @method_index, @index, PARAMFLAG_FOPT)
end

#output?Boolean

Returns:

  • (Boolean)


4301
4302
4303
# File 'lib/win32ole-pr.rb', line 4301

def output?
  ole_param_flag_mask(@pTypeInfo, @method_index, @index, PARAMFLAG_FOUT)
end

#retval?Boolean

Returns:

  • (Boolean)


4309
4310
4311
# File 'lib/win32ole-pr.rb', line 4309

def retval?
  ole_param_flag_mask(@pTypeInfo, @method_index, @index, PARAMFLAG_FRETVAL)
end