Class: WIN32OLE_VARIABLE

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.



3445
3446
3447
# File 'lib/win32ole-pr.rb', line 3445

def index
  @index
end

#nameObject Also known as: to_s

Returns the value of attribute name.



3445
3446
3447
# File 'lib/win32ole-pr.rb', line 3445

def name
  @name
end

#pTypeInfoObject

Returns the value of attribute pTypeInfo.



3445
3446
3447
# File 'lib/win32ole-pr.rb', line 3445

def pTypeInfo
  @pTypeInfo
end

Instance Method Details

#inspectObject



3617
3618
3619
# File 'lib/win32ole-pr.rb', line 3617

def inspect
   "#<#{self.class}:#{self.to_s}=#{self.value.inpect}>"
end

#ole_typeObject



3471
3472
3473
# File 'lib/win32ole-pr.rb', line 3471

def ole_type
   ole_variable_ole_type(@pTypeInfo,@index)
end

#ole_type_detailObject



3498
3499
3500
# File 'lib/win32ole-pr.rb', line 3498

def ole_type_detail
   ole_variable_ole_type_detail(@pTypeInfo, @index)
end

#ole_variable_kind(pTypeInfo, var_index) ⇒ Object



3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
# File 'lib/win32ole-pr.rb', line 3558

def ole_variable_kind(pTypeInfo,var_index)
   kind = "UNKNOWN"
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')
   
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   return kind if hr != S_OK
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)            
   case varDesc[32,4].unpack('L').first
   when VAR_PERINSTANCE
      kind = PERINSTANCE
   when VAR_STATIC
      kind = STATIC
   when VAR_CONST
      kind = CONSTANT
   when VAR_DISPATCH
      kind = DISPATCH
   end
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   kind
end

#ole_variable_ole_type(pTypeInfo, var_index) ⇒ Object



3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
# File 'lib/win32ole-pr.rb', line 3449

def ole_variable_ole_type(pTypeInfo,var_index)
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')
   
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   if hr != S_OK
      raise WIN32OLERuntimeError, "failed to GetVarDesc"
   end
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)      
   type = WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo, varDesc[12,8], nil)
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   type
end

#ole_variable_ole_type_detail(pTypeInfo, var_index) ⇒ Object



3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
# File 'lib/win32ole-pr.rb', line 3475

def ole_variable_ole_type_detail(pTypeInfo,var_index)
   type = []
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')
   
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   if hr != S_OK
      raise WIN32OLERuntimeError, "failed to GetVarDesc"
   end
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)      
   WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo,varDesc[12,8],type)
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   type
end

#ole_variable_value(pTypeInfo, var_index) ⇒ Object



3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
# File 'lib/win32ole-pr.rb', line 3502

def ole_variable_value(pTypeInfo,var_index)
   val = nil
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')
   
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   return nil if hr != S_OK
      
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)      
   if varDesc[32,4].unpack('L').first == VAR_CONST
      val = WIN32OLE.ole_variant2val(varDesc[8,4].unpack('L').first)
   end
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   val
end

#ole_variable_varkind(pTypeInfo, var_index) ⇒ Object



3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
# File 'lib/win32ole-pr.rb', line 3592

def ole_variable_varkind(pTypeInfo,var_index)
   kind = nil
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')
   
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   return kind if hr != S_OK
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)      
   kind = varDesc[32,4].unpack('L').first
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   kind
end

#ole_variable_visible(pTypeInfo, var_index) ⇒ Object



3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
# File 'lib/win32ole-pr.rb', line 3530

def ole_variable_visible(pTypeInfo,var_index)
   visible = false
   lpVtbl = 0.chr * 4
   table = 0.chr * 88
   memcpy(lpVtbl,pTypeInfo,4)
   memcpy(table,lpVtbl.unpack('L').first,88)
   table = table.unpack('L*')    
   getVarDesc = Win32::API::Function.new(table[6],'PLP','L')
   releaseVarDesc = Win32::API::Function.new(table[21],'PP','L')
   p = 0.chr * 4
   hr = getVarDesc.call(pTypeInfo,var_index,p)
   pVarDesc = p.unpack('L').first
   return visible if hr != S_OK
   varDesc = 0.chr * 36
   memcpy(varDesc,pVarDesc,36)      
   if (varDesc[28,2].unpack('S').first & (VARFLAG_FHIDDEN |
                              VARFLAG_FRESTRICTED |
                              VARFLAG_FNONBROWSABLE)) == 0
      visible = true
   end
   releaseVarDesc.call(pTypeInfo, pVarDesc)
   visible
end

#valueObject



3526
3527
3528
# File 'lib/win32ole-pr.rb', line 3526

def value
   ole_variable_value(@pTypeInfo, @index)
end

#variable_kindObject



3588
3589
3590
# File 'lib/win32ole-pr.rb', line 3588

def variable_kind
   ole_variable_kind(@pTypeInfo, @index)
end

#varkindObject



3613
3614
3615
# File 'lib/win32ole-pr.rb', line 3613

def varkind
   ole_variable_varkind(@pTypeInfo, @index)
end

#visible?Boolean

Returns:

  • (Boolean)


3554
3555
3556
# File 'lib/win32ole-pr.rb', line 3554

def visible?
   ole_variable_visible(@pTypeInfo, @index)
end