Class: WIN32OLE_METHOD
- Inherits:
-
Object
- Object
- WIN32OLE_METHOD
- Defined in:
- lib/win32ole-pr.rb
Constant Summary collapse
- IMPLTYPEFLAG_FDEFAULT =
0x1
- IMPLTYPEFLAG_FSOURCE =
0x2
- IMPLTYPEFLAG_FRESTRICTED =
0x4
- IMPLTYPEFLAG_FDEFAULTVTABLE =
0x8
Instance Method Summary collapse
- #dispid ⇒ Object
- #event? ⇒ Boolean
- #event_interface ⇒ Object
- #helpcontext ⇒ Object
- #helpfile ⇒ Object
- #helpstring ⇒ Object
-
#initialize(oletype = nil, method = nil) ⇒ WIN32OLE_METHOD
constructor
A new instance of WIN32OLE_METHOD.
- #inspect ⇒ Object
- #invkind ⇒ Object
- #invoke_kind ⇒ Object
- #name ⇒ Object (also: #to_s)
- #offset_vtbl ⇒ Object
- #ole_method_dispid(pTypeInfo, method_index) ⇒ Object
- #ole_method_docinfo_from_type(pTypeInfo, method_index, name, helpstr, helpcontext, helpfile) ⇒ Object
- #ole_method_event(pTypeInfo, method_index, method_name) ⇒ Object
- #ole_method_helpcontext(pTypeInfo, method_index) ⇒ Object
- #ole_method_helpfile(pTypeInfo, method_index) ⇒ Object
- #ole_method_helpstring(pTypeInfo, method_index) ⇒ Object
- #ole_method_invkind(pTypeInfo, method_index) ⇒ Object
- #ole_method_invoke_kind(pTypeInfo, method_index) ⇒ Object
- #ole_method_offset_vtbl(pTypeInfo, method_index) ⇒ Object
- #ole_method_params(pTypeInfo, method_index) ⇒ Object
- #ole_method_return_type(pTypeInfo, method_index) ⇒ Object
- #ole_method_return_type_detail(pTypeInfo, method_index) ⇒ Object
- #ole_method_return_vtype(pTypeInfo, method_index) ⇒ Object
- #ole_method_size_opt_params(pTypeInfo, method_index) ⇒ Object
- #ole_method_size_params(pTypeInfo, method_index) ⇒ Object
- #ole_method_sub(pOwnerTypeInfo, pTypeInfo, name) ⇒ Object
- #ole_method_visible(pTypeInfo, method_index) ⇒ Object
- #olemethod_from_typeinfo(pTypeInfo, name) ⇒ Object
- #olemethod_set_member(pTypeInfo, pOwnerTypeInfo, index, name) ⇒ Object
- #params ⇒ Object
- #return_type ⇒ Object
- #return_type_detail ⇒ Object
- #return_vtype ⇒ Object
- #size_opt_params ⇒ Object
- #size_params ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(oletype = nil, method = nil) ⇒ WIN32OLE_METHOD
Returns a new instance of WIN32OLE_METHOD.
3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 |
# File 'lib/win32ole-pr.rb', line 3726 def initialize(oletype=nil, method=nil) @pTypeInfo = nil @pOwnerTypeInfo = nil @index = 0 return self if oletype.nil? if oletype.is_a?(WIN32OLE_TYPE) unless method.is_a?(String) raise TypeError,"2nd parameter must be String" end obj = olemethod_from_typeinfo(oletype.pTypeInfo,method) if obj.nil? raise WIN32OLERuntimeError, "not found #{method}" end else raise TypeError, "1st argument should be WIN32OLE_TYPE object" end end |
Instance Method Details
#dispid ⇒ Object
4071 4072 4073 |
# File 'lib/win32ole-pr.rb', line 4071 def dispid ole_method_dispid(@pTypeInfo,@index) end |
#event? ⇒ Boolean
3970 3971 3972 |
# File 'lib/win32ole-pr.rb', line 3970 def event? ole_method_event(@pOwnerTypeInfo,@index,self.name) end |
#event_interface ⇒ Object
3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 |
# File 'lib/win32ole-pr.rb', line 3974 def event_interface if event? name = 0.chr * 4 hr = WIN32OLE_TYPE.ole_docinfo_from_type(@pTypeInfo, name, nil, nil, nil) if hr == S_OK str = 0.chr * 256 wcscpy(str,name.unpack('L').first) return wide_to_multi(str) end end nil end |
#helpcontext ⇒ Object
4046 4047 4048 |
# File 'lib/win32ole-pr.rb', line 4046 def helpcontext ole_method_helpcontext(@pTypeInfo,@index) end |
#helpfile ⇒ Object
4035 4036 4037 |
# File 'lib/win32ole-pr.rb', line 4035 def helpfile ole_method_helpfile(@pTypeInfo,@index) end |
#helpstring ⇒ Object
4022 4023 4024 |
# File 'lib/win32ole-pr.rb', line 4022 def helpstring ole_method_helpstring(@pTypeInfo,@index) end |
#inspect ⇒ Object
4199 4200 4201 |
# File 'lib/win32ole-pr.rb', line 4199 def inspect "#<#{self.class}:#{self.to_s}>" end |
#invkind ⇒ Object
3866 3867 3868 |
# File 'lib/win32ole-pr.rb', line 3866 def invkind ole_method_invkind(@pTypeInfo,@index) end |
#invoke_kind ⇒ Object
3862 3863 3864 |
# File 'lib/win32ole-pr.rb', line 3862 def invoke_kind ole_method_invoke_kind(@pTypeInfo,@index) end |
#name ⇒ Object Also known as: to_s
3744 3745 3746 |
# File 'lib/win32ole-pr.rb', line 3744 def name @name end |
#offset_vtbl ⇒ Object
4096 4097 4098 |
# File 'lib/win32ole-pr.rb', line 4096 def offset_vtbl ole_method_offset_vtbl(@pTypeInfo,@index) end |
#ole_method_dispid(pTypeInfo, method_index) ⇒ Object
4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 |
# File 'lib/win32ole-pr.rb', line 4050 def ole_method_dispid(pTypeInfo,method_index) dispid = 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 dispid if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) dispid = funcDesc[0,4].unpack('L').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) dispid end |
#ole_method_docinfo_from_type(pTypeInfo, method_index, name, helpstr, helpcontext, helpfile) ⇒ Object
3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 |
# File 'lib/win32ole-pr.rb', line 3987 def ole_method_docinfo_from_type(pTypeInfo,method_index,name,helpstr,helpcontext,helpfile) 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') getDocumentation = Win32::API::Function.new(table[12],'PLPPPP','L') getRefTypeOfImplType = Win32::API::Function.new(table[8],'PLP','L') getImplTypeFlags = Win32::API::Function.new(table[9],'PLP','L') getRefTypeInfo = Win32::API::Function.new(table[14],'PLP','L') releaseTypeAttr = Win32::API::Function.new(table[19],'PP','L') releaseFuncDesc = Win32::API::Function.new(table[20],'PP','L') p = 0.chr * 4 hr = getFuncDesc.call(pTypeInfo, method_index, p) return hr if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) memid = funcDesc[0,4].unpack('L').first hr = getDocumentation.call(pTypeInfo,memid,name,helpstr,helpcontext,helpfile) releaseFuncDesc.call(pTypeInfo, pFuncDesc) hr end |
#ole_method_event(pTypeInfo, method_index, method_name) ⇒ Object
3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 |
# File 'lib/win32ole-pr.rb', line 3900 def ole_method_event(pTypeInfo,method_index,method_name) event = 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') getDocumentation = Win32::API::Function.new(table[12],'PLPPPP','L') getRefTypeOfImplType = Win32::API::Function.new(table[8],'PLP','L') getImplTypeFlags = Win32::API::Function.new(table[9],'PLP','L') getRefTypeInfo = Win32::API::Function.new(table[14],'PLP','L') getFuncDesc = Win32::API::Function.new(table[5],'PLP','L') releaseTypeAttr = Win32::API::Function.new(table[19],'PP','L') releaseFuncDesc = Win32::API::Function.new(table[20],'PP','L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo,p) pTypeAttr = p.unpack('L').first return event if hr != S_OK typeAttr = 0.chr * 76 memcpy(typeAttr,pTypeAttr,76) if typeAttr[40,4].unpack('L').first != TKIND_COCLASS releaseTypeAttr.call(pTypeInfo, pTypeAttr) return event end for i in 0 ... typeAttr[48,2].unpack('S').first flags = 0.chr * 4 hr = getImplTypeFlags.call(pTypeInfo, i,flags) next if hr != S_OK if (flags.unpack('L').first & IMPLTYPEFLAG_FSOURCE) != 0 href = 0.chr * 4 hr = getRefTypeOfImplType.call(pTypeInfo,i,href) next if hr != S_OK href = href.unpack('L').first p = 0.chr * 4 hr = getRefTypeInfo.call(pTypeInfo,href,p) next if hr != S_OK pRefTypeInfo = p.unpack('L').first p = 0.chr * 4 hr = getFuncDesc.call(pRefTypeInfo,method_index,p) if hr != S_OK WIN32OLE.ole_release(pRefTypeInfo) next end pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) memid = funcDesc[0,4].unpack('L').first bstr = 0.chr * 4 hr = getDocumentation.call(pRefTypeInfo,memid,bstr,nil,nil,nil) if hr != S_OK releaseFuncDesc.call(pRefTypeInfo, pFuncDesc) WIN32OLE.ole_release(pRefTypeInfo) next end str = 0.chr * 256 wcscpy(str,bstr.unpack('L').first) name = wide_to_multi(str) releaseFuncDesc.call(pRefTypeInfo,pFuncDesc) WIN32OLE.ole_release(pRefTypeInfo) if method_name == name event = true break end end end releaseTypeAttr.call(pTypeInfo, pTypeAttr) event end |
#ole_method_helpcontext(pTypeInfo, method_index) ⇒ Object
4039 4040 4041 4042 4043 4044 |
# File 'lib/win32ole-pr.rb', line 4039 def ole_method_helpcontext(pTypeInfo,method_index) helpcontext = 0.chr * 4 hr = ole_method_docinfo_from_type(pTypeInfo, method_index, nil, nil, helpcontext, nil) return nil if hr != S_OK helpcontext.unpack('L').first end |
#ole_method_helpfile(pTypeInfo, method_index) ⇒ Object
4026 4027 4028 4029 4030 4031 4032 4033 |
# File 'lib/win32ole-pr.rb', line 4026 def ole_method_helpfile(pTypeInfo,method_index) bhelpfile = 0.chr * 4 hr = ole_method_docinfo_from_type(pTypeInfo, method_index, nil, nil, nil, bhelpfile) return nil if hr != S_OK str = 0.chr * 256 wcscpy(str,bhelpfile.unpack('L').first) wide_to_multi(str) end |
#ole_method_helpstring(pTypeInfo, method_index) ⇒ Object
4013 4014 4015 4016 4017 4018 4019 4020 |
# File 'lib/win32ole-pr.rb', line 4013 def ole_method_helpstring(pTypeInfo,method_index) bhelpstring = 0.chr * 4 hr = ole_method_docinfo_from_type(pTypeInfo,method_index,nil,bhelpstring,nil,nil) return nil if hr != S_OK str = 0.chr * 256 wcscpy(str,bhelpstring.unpack('L').first) wide_to_multi(str) end |
#ole_method_invkind(pTypeInfo, method_index) ⇒ Object
3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 |
# File 'lib/win32ole-pr.rb', line 3824 def ole_method_invkind(pTypeInfo,method_index) lpVtbl = 0.chr * 4 table = 0.chr * 88 memcpy(lpVtbl,pTypeInfo,4) memcpy(table,lpVtbl.unpack('L').first,88) table = table.unpack('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) pFuncDesc = p.unpack('L').first if hr != S_OK raise WIN32OLERuntimeError, "failed to GetFuncDesc" end funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) invkind = funcDesc[16,4].unpack('L').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) invkind end |
#ole_method_invoke_kind(pTypeInfo, method_index) ⇒ Object
3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 |
# File 'lib/win32ole-pr.rb', line 3845 def ole_method_invoke_kind(pTypeInfo,method_index) type = "UNKNOWN" invkind = ole_method_invkind(pTypeInfo, method_index) if (invkind & INVOKE_PROPERTYGET) != 0 && (invkind & INVOKE_PROPERTYPUT) != 0 type = "PROPERTY" elsif (invkind & INVOKE_PROPERTYGET) != 0 type = "PROPERTYGET" elsif (invkind & INVOKE_PROPERTYPUT) != 0 type = "PROPERTYPUT" elsif (invkind & INVOKE_PROPERTYPUTREF) != 0 type = "PROPERTYPUTREF" elsif (invkind & INVOKE_FUNC) != 0 type = "FUNC" end type end |
#ole_method_offset_vtbl(pTypeInfo, method_index) ⇒ Object
4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 |
# File 'lib/win32ole-pr.rb', line 4075 def ole_method_offset_vtbl(pTypeInfo,method_index) offset_vtbl = 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 offset_vtbl if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) offset_vtbl = funcDesc[28,2].unpack('S').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) offset_vtbl end |
#ole_method_params(pTypeInfo, method_index) ⇒ Object
4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 |
# File 'lib/win32ole-pr.rb', line 4150 def ole_method_params(pTypeInfo,method_index) params = [] 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') getNames = Win32::API::Function.new(table[7],'PLPLP','L') p = 0.chr * 4 hr = getFuncDesc.call(pTypeInfo, method_index, p) return params if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) memid = funcDesc[0,4].unpack('L').first cParams = funcDesc[24,2].unpack('S').first bstrs = 0.chr * 4 * (cParams + 1) len = 0.chr * 4 hr = getNames.call(pTypeInfo,memid,bstrs,cParams + 1,len) if hr != S_OK releaseFuncDesc.call(pTypeInfo, pFuncDesc) params end if cParams > 0 for i in 1 ... len.unpack('L').first param = WIN32OLE_PARAM.new param.pTypeInfo = pTypeInfo WIN32OLE.ole_addref(pTypeInfo) param.method_index = method_index param.index = i - 1 bstr = bstrs[i*4,4].unpack('L').first str = 0.chr * 256 wcscpy(str,bstr) SysFreeString(bstr) param.name = wide_to_multi(str) params.push(param) end end releaseFuncDesc.call(pTypeInfo, pFuncDesc) params end |
#ole_method_return_type(pTypeInfo, method_index) ⇒ Object
3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 |
# File 'lib/win32ole-pr.rb', line 3749 def ole_method_return_type(pTypeInfo,method_index) lpVtbl = 0.chr * 4 table = 0.chr * 88 memcpy(lpVtbl,pTypeInfo,4) memcpy(table,lpVtbl.unpack('L').first,88) table = table.unpack('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) pFuncDesc = p.unpack('L').first if hr != S_OK raise WIN32OLERuntimeError, "failed to GetFuncDesc" end funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) type = WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo,funcDesc[32,8],nil) releaseFuncDesc.call(pTypeInfo, pFuncDesc) type end |
#ole_method_return_type_detail(pTypeInfo, method_index) ⇒ Object
3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 |
# File 'lib/win32ole-pr.rb', line 3799 def ole_method_return_type_detail(pTypeInfo,method_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*') 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) pFuncDesc = p.unpack('L').first return type if hr != S_OK funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo,funcDesc[32,8],type) releaseFuncDesc.call(pTypeInfo, pFuncDesc) type end |
#ole_method_return_vtype(pTypeInfo, method_index) ⇒ Object
3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 |
# File 'lib/win32ole-pr.rb', line 3774 def ole_method_return_vtype(pTypeInfo,method_index) lpVtbl = 0.chr * 4 table = 0.chr * 88 memcpy(lpVtbl,pTypeInfo,4) memcpy(table,lpVtbl.unpack('L').first,88) table = table.unpack('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) pFuncDesc = p.unpack('L').first if hr != S_OK raise WIN32OLERuntimeError, "failed to GetFuncDesc" end funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) vvt = funcDesc[36,2].unpack('S').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) vvt end |
#ole_method_size_opt_params(pTypeInfo, method_index) ⇒ Object
4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 |
# File 'lib/win32ole-pr.rb', line 4125 def ole_method_size_opt_params(pTypeInfo,method_index) size_opt_params = 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 size_opt_params if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) size_opt_params = funcDesc[26,2].unpack('S').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) size_opt_params end |
#ole_method_size_params(pTypeInfo, method_index) ⇒ Object
4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 |
# File 'lib/win32ole-pr.rb', line 4100 def ole_method_size_params(pTypeInfo,method_index) size_params = 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 size_params if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) size_params = funcDesc[24,2].unpack('S').first releaseFuncDesc.call(pTypeInfo, pFuncDesc) size_params end |
#ole_method_sub(pOwnerTypeInfo, pTypeInfo, name) ⇒ Object
3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 |
# File 'lib/win32ole-pr.rb', line 3638 def ole_method_sub(pOwnerTypeInfo,pTypeInfo,name) 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') getNames = Win32::API::Function.new(table[7],'PLPLP','L') getDocumentation = Win32::API::Function.new(table[12],'PLPPPP','L') releaseTypeAttr = Win32::API::Function.new(table[19],'PP','L') releaseFuncDesc = Win32::API::Function.new(table[20],'PP','L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo,p) if hr != S_OK raise WIN32OLERuntimeError, "failed to GetTypeAttr" end pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr,pTypeAttr,76) method = nil for i in 0 .. typeAttr[44,2].unpack('S').first break if method != nil p = 0.chr * 4 hr = getFuncDesc.call(pTypeInfo,i,p) next if hr != S_OK pFuncDesc = p.unpack('L').first funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) memid = funcDesc[0,4].unpack('L').first bstr = 0.chr * 4 hr = getDocumentation.call(pTypeInfo,memid,bstr,nil,nil,nil) if hr != S_OK releaseFuncDesc.call(pTypeInfo,pFuncDesc) next end str = 0.chr * 256 wcscpy(str,bstr.unpack('L').first) fname = wide_to_multi(str) if name.casecmp(fname)==0 olemethod_set_member(pTypeInfo,pOwnerTypeInfo,i,fname) method = self end releaseFuncDesc.call(pTypeInfo,pFuncDesc) pFuncDesc = nil end releaseTypeAttr.call(pTypeInfo, pTypeAttr) method end |
#ole_method_visible(pTypeInfo, method_index) ⇒ Object
3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 |
# File 'lib/win32ole-pr.rb', line 3870 def ole_method_visible(pTypeInfo,method_index) lpVtbl = 0.chr * 4 table = 0.chr * 88 memcpy(lpVtbl,pTypeInfo,4) memcpy(table,lpVtbl.unpack('L').first,88) table = table.unpack('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) pFuncDesc = p.unpack('L').first return false if hr != S_OK funcDesc = 0.chr * 52 memcpy(funcDesc,pFuncDesc,52) if (funcDesc[48,2].unpack('S').first & (FUNCFLAG_FRESTRICTED | FUNCFLAG_FHIDDEN | FUNCFLAG_FNONBROWSABLE)) != 0 visible = false else visible = true end releaseFuncDesc.call(pTypeInfo, pFuncDesc) visible end |
#olemethod_from_typeinfo(pTypeInfo, name) ⇒ Object
3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 |
# File 'lib/win32ole-pr.rb', line 3688 def olemethod_from_typeinfo(pTypeInfo,name) lpVtbl = 0.chr * 4 table = 0.chr * 88 memcpy(lpVtbl,pTypeInfo,4) memcpy(table,lpVtbl.unpack('L').first,88) table = table.unpack('L*') pTypeAttr = 0.chr * 4 getRefTypeOfImplType = Win32::API::Function.new(table[8],'PLP','L') getTypeAttr = Win32::API::Function.new(table[3],'PP','L') getRefTypeInfo = Win32::API::Function.new(table[14],'PLP','L') releaseTypeAttr = Win32::API::Function.new(table[19],'PP','L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo,p) if hr != S_OK raise WIN32OLERuntimeError, "failed to GetTypeAttr" end method = ole_method_sub(0,pTypeInfo,name) return method if method pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr,pTypeAttr,76) for i in 0 ... typeAttr[48,2].unpack('S').first break if method p = 0.chr * 4 hr = getRefTypeOfImplType.call(pTypeInfo, i, p) next if hr != S_OK href = p.unpack('L').first p = 0.chr * 4 hr = getRefTypeInfo.call(pTypeInfo, href,p) next if hr != S_OK pRefTypeInfo = p.unpack('L').first method = ole_method_sub(pTypeInfo,pRefTypeInfo,name) WIN32OLE.ole_release(pRefTypeInfo) end releaseTypeAttr.call(pTypeInfo, pTypeAttr) method end |
#olemethod_set_member(pTypeInfo, pOwnerTypeInfo, index, name) ⇒ Object
3628 3629 3630 3631 3632 3633 3634 3635 3636 |
# File 'lib/win32ole-pr.rb', line 3628 def olemethod_set_member(pTypeInfo,pOwnerTypeInfo,index,name) @pTypeInfo = pTypeInfo WIN32OLE.ole_addref(pTypeInfo) @pOwnerTypeInfo = pOwnerTypeInfo WIN32OLE.ole_addref(pOwnerTypeInfo) if pOwnerTypeInfo != 0 @index = index @name = name self end |
#params ⇒ Object
4195 4196 4197 |
# File 'lib/win32ole-pr.rb', line 4195 def params ole_method_params(@pTypeInfo,@index) end |
#return_type ⇒ Object
3770 3771 3772 |
# File 'lib/win32ole-pr.rb', line 3770 def return_type ole_method_return_type(@pTypeInfo,@index) end |
#return_type_detail ⇒ Object
3820 3821 3822 |
# File 'lib/win32ole-pr.rb', line 3820 def return_type_detail ole_method_return_type_detail(@pTypeInfo,@index) end |
#return_vtype ⇒ Object
3795 3796 3797 |
# File 'lib/win32ole-pr.rb', line 3795 def return_vtype ole_method_return_vtype(@pTypeInfo,@index) end |
#size_opt_params ⇒ Object
4146 4147 4148 |
# File 'lib/win32ole-pr.rb', line 4146 def size_opt_params ole_method_size_opt_params(@pTypeInfo,@index) end |
#size_params ⇒ Object
4121 4122 4123 |
# File 'lib/win32ole-pr.rb', line 4121 def size_params ole_method_size_params(@pTypeInfo,@index) end |
#visible? ⇒ Boolean
3896 3897 3898 |
# File 'lib/win32ole-pr.rb', line 3896 def visible? ole_method_visible(@pTypeInfo,@index) end |