類別 WIN32OLE::Variable
公開實例方法
WIN32OLE_VARIABLE#inspect → 字串 按一下以切換來源
傳回 OLE 變數名稱和具有類別名稱的值。
static VALUE folevariable_inspect(VALUE self) { VALUE v = rb_inspect(folevariable_value(self)); VALUE n = folevariable_name(self); VALUE detail = rb_sprintf("%"PRIsVALUE"=%"PRIsVALUE, n, v); return make_inspect("WIN32OLE_VARIABLE", detail); }
WIN32OLE_VARIABLE#name 按一下以切換來源
傳回變數的名稱。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name}" end The result of above script is following: xlChart xlDialogSheet xlExcel4IntlMacroSheet xlExcel4MacroSheet xlWorksheet
static VALUE folevariable_name(VALUE self) { return rb_ivar_get(self, rb_intern("name")); }
別名為: to_s
WIN32OLE_VARIABLE#ole_type 按一下以切換來源
傳回 OLE 型別字串。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.ole_type} #{variable.name}" end The result of above script is following: INT xlChart INT xlDialogSheet INT xlExcel4IntlMacroSheet INT xlExcel4MacroSheet INT xlWorksheet
static VALUE folevariable_ole_type(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_ole_type(pvar->pTypeInfo, pvar->index); }
WIN32OLE_VARIABLE#ole_type_detail 按一下以切換來源
傳回型別的詳細資訊。資訊是型別陣列。
tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS') variable = tobj.variables.find {|variable| variable.name == 'lFlags'} tdetail = variable.ole_type_detail p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
static VALUE folevariable_ole_type_detail(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index); }
WIN32OLE_VARIABLE#name
傳回變數的名稱。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name}" end The result of above script is following: xlChart xlDialogSheet xlExcel4IntlMacroSheet xlExcel4MacroSheet xlWorksheet
別名為: name
WIN32OLE_VARIABLE#value 按一下以切換來源
如果值存在,則傳回值。如果值不存在,則此方法傳回 nil。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.value}" end The result of above script is following: xlChart = -4109 xlDialogSheet = -4116 xlExcel4IntlMacroSheet = 4 xlExcel4MacroSheet = 3 xlWorksheet = -4167
static VALUE folevariable_value(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_value(pvar->pTypeInfo, pvar->index); }
WIN32OLE_VARIABLE#variable_kind 按一下以切換來源
傳回變數種類字串。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.variable_kind}" end The result of above script is following: xlChart CONSTANT xlDialogSheet CONSTANT xlExcel4IntlMacroSheet CONSTANT xlExcel4MacroSheet CONSTANT xlWorksheet CONSTANT
static VALUE folevariable_variable_kind(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_kind(pvar->pTypeInfo, pvar->index); }
WIN32OLE_VARIABLE#varkind 按一下以切換來源
傳回表示變數種類的數字。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.varkind}" end The result of above script is following: xlChart 2 xlDialogSheet 2 xlExcel4IntlMacroSheet 2 xlExcel4MacroSheet 2 xlWorksheet 2
static VALUE folevariable_varkind(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_varkind(pvar->pTypeInfo, pvar->index); }
WIN32OLE_VARIABLE#visible? 按一下以切換來源
如果變數是公開的,則傳回 true。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.visible?}" end The result of above script is following: xlChart true xlDialogSheet true xlExcel4IntlMacroSheet true xlExcel4MacroSheet true xlWorksheet true
static VALUE folevariable_visible(VALUE self) { struct olevariabledata *pvar; TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar); return ole_variable_visible(pvar->pTypeInfo, pvar->index); }