Class: WIN32OLE_TYPE
- Inherits:
-
Object
- Object
- WIN32OLE_TYPE
- Defined in:
- lib/win32ole-pr.rb
Instance Attribute Summary collapse
-
#pTypeInfo ⇒ Object
Returns the value of attribute pTypeInfo.
Class Method Summary collapse
- .ole_classes(typelib) ⇒ Object
- .ole_docinfo_from_type(pTypeInfo, name, helpstr, helpcontext, helpfile) ⇒ Object
- .ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
- .ole_type_helpstring(pTypeInfo) ⇒ Object
- .ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
- .ole_usertype2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
- .progids ⇒ Object
- .typelibs ⇒ Object
Instance Method Summary collapse
- #default_event_sources ⇒ Object
- #default_ole_types ⇒ Object
- #guid ⇒ Object
- #helpcontext ⇒ Object
- #helpfile ⇒ Object
- #helpstring ⇒ Object
- #implemented_ole_types ⇒ Object
-
#initialize(typelib = nil, ole_class = nil) ⇒ WIN32OLE_TYPE
constructor
A new instance of WIN32OLE_TYPE.
- #inspect ⇒ Object
- #major_version ⇒ Object
- #minor_version ⇒ Object
- #name ⇒ Object (also: #to_s)
- #ole_methods ⇒ Object
- #ole_ole_type(pTypeInfo) ⇒ Object
- #ole_type ⇒ Object
- #ole_type_guid(pTypeInfo) ⇒ Object
- #ole_type_helpcontext(pTypeInfo) ⇒ Object
- #ole_type_helpfile(pTypeInfo) ⇒ Object
- #ole_type_impl_ole_types(pTypeInfo, implflags) ⇒ Object
- #ole_type_major_version(pTypeInfo) ⇒ Object
- #ole_type_minor_version(pTypeInfo) ⇒ Object
- #ole_type_progid(pTypeInfo) ⇒ Object
- #ole_type_src_type(pTypeInfo) ⇒ Object
- #ole_type_typekind(pTypeInfo) ⇒ Object
- #ole_type_visible(pTypeInfo) ⇒ Object
- #ole_typelib ⇒ Object
- #ole_variables(pTypeInfo) ⇒ Object
- #oletype_set_member(pTypeInfo, name) ⇒ Object
- #progid ⇒ Object
- #source_ole_types ⇒ Object
- #src_type ⇒ Object
- #typekind ⇒ Object
- #variables ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(typelib = nil, ole_class = nil) ⇒ WIN32OLE_TYPE
Returns a new instance of WIN32OLE_TYPE.
2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 |
# File 'lib/win32ole-pr.rb', line 2862 def initialize(typelib=nil, ole_class=nil) WIN32OLE.ole_initialize() @pTypeInfo = nil return self if typelib.nil? unless typelib.is_a?(String) raise TypeError, "wrong argument type (expected String)" end unless ole_class.is_a?(String) raise TypeError, "wrong argument type (expected String)" end file = WIN32OLE_TYPELIB.typelib_file(typelib) type = typlelib if file.nil? buf = multi_to_wide(file) p = 0.chr * 4 hr = LoadTypeLibEx(buf, REGKIND_NONE, p) pTypeLib = p.unpack('L').first if hr != S_OK raise WIN32OLERuntimeError, "failed to LoadTypeLibEx" end if WIN32OLE.oleclass_from_typelib(self, pTypeLib, ole_class) == false WIN32OLE.ole_release(pTypeLib) raise WIN32OLERuntimeError, "not found `#{ole_class}` in `#{typelib}`" end WIN32OLE.ole_release(pTypeLib) self end |
Instance Attribute Details
#pTypeInfo ⇒ Object
Returns the value of attribute pTypeInfo.
2813 2814 2815 |
# File 'lib/win32ole-pr.rb', line 2813 def pTypeInfo @pTypeInfo end |
Class Method Details
.ole_classes(typelib) ⇒ Object
2821 2822 2823 |
# File 'lib/win32ole-pr.rb', line 2821 def self.ole_classes(typelib) WIN32OLE_TYPELIB.new(typelib).ole_types end |
.ole_docinfo_from_type(pTypeInfo, name, helpstr, helpcontext, helpfile) ⇒ Object
3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 |
# File 'lib/win32ole-pr.rb', line 3104 def self.ole_docinfo_from_type(pTypeInfo, name, helpstr, helpcontext, helpfile) lpVtbl = 0.chr * 4 table = 0.chr * 80 memcpy(lpVtbl, pTypeInfo, 4) memcpy(table, lpVtbl.unpack('L').first, 80) table = table.unpack('L*') getContainingTypeLib = Win32::API::Function.new(table[18], 'PPP', 'L') p = 0.chr * 4 i = 0.chr * 4 hr = getContainingTypeLib.call(pTypeInfo, p, i) return hr if hr != S_OK i = i.unpack('L').first pTypeLib = p.unpack('L').first lpVtbl = 0.chr * 4 table = 0.chr * 40 memcpy(lpVtbl, pTypeLib, 4) memcpy(table, lpVtbl.unpack('L').first, 40) table = table.unpack('L*') getDocumentation = Win32::API::Function.new(table[9], 'PLPPPP', 'L') hr = getDocumentation.call(pTypeLib, i, name, helpstr, helpcontext, helpfile) WIN32OLE.ole_release(pTypeLib) hr end |
.ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 |
# File 'lib/win32ole-pr.rb', line 3168 def self.ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) type = "" vt = pTypeDesc[4, 2].unpack('S').first if vt == VT_PTR || vt == VT_SAFEARRAY typedesc = 0.chr * 8 memcpy(typedesc, pTypeDesc[0, 4].unpack('L').first, 8) type = ole_typedesc2val(pTypeInfo, typedesc, typedetails) end type end |
.ole_type_helpstring(pTypeInfo) ⇒ Object
3128 3129 3130 3131 3132 3133 3134 3135 |
# File 'lib/win32ole-pr.rb', line 3128 def self.ole_type_helpstring(pTypeInfo) bhelpstr = 0.chr * 4 hr = ole_docinfo_from_type(pTypeInfo, nil, bhelpstr, nil, nil) return nil if hr != S_OK str = 0.chr * 256 wcscpy(str, bhelpstr.unpack('L').first) wide_to_multi(str) end |
.ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 |
# File 'lib/win32ole-pr.rb', line 3180 def self.ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails) typestr = nil vt = pTypeDesc[4, 2].unpack('S').first case vt when VT_I2 typestr = "I2" when VT_I4 typestr = "I4" when VT_R4 typestr = "R4" when VT_R8 typestr = "R8" when VT_CY typestr = "CY" when VT_DATE typestr = "DATE" when VT_BSTR typestr = "BSTR" when VT_BOOL typestr = "BOOL" when VT_VARIANT typestr = "VARIANT" when VT_DECIMAL typestr = "DECIMAL" when VT_I1 typestr = "I1" when VT_UI1 typestr = "UI1" when VT_UI2 typestr = "UI2" when VT_UI4 typestr = "UI4" when VT_I8 typestr = "I8" when VT_UI8 typestr = "UI8" when VT_INT typestr = "INT" when VT_UINT typestr = "UINT" when VT_VOID typestr = "VOID" when VT_HRESULT typestr = "HRESULT" when VT_PTR typestr = "PTR" if typedetails typedetails.push(typestr) end return ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) when VT_SAFEARRAY typestr = "SAFEARRAY" if typedetails typedetails.push(typestr) end return ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) when VT_CARRAY typestr = "CARRAY" when VT_USERDEFINED typestr = "USERDEFINED" if typedetails typedetails.push(typestr) end str = WIN32OLE_TYPE.ole_usertype2val(pTypeInfo, pTypeDesc, typedetails) return str if str return typestr when VT_UNKNOWN typestr = "UNKNOWN" when VT_DISPATCH typestr = "DISPATCH" when VT_ERROR typestr = "ERROR" when VT_LPWSTR typestr = "LPWSTR" when VT_LPSTR typestr = "LPSTR" else typestr = "Unknown Type #{vt}" end if typedetails typedetails.push(typestr) end typestr end |
.ole_usertype2val(pTypeInfo, pTypeDesc, typedetails) ⇒ Object
3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 |
# File 'lib/win32ole-pr.rb', line 3141 def self.ole_usertype2val(pTypeInfo, pTypeDesc, typedetails) lpVtbl = 0.chr * 4 table = 0.chr * 80 memcpy(lpVtbl, pTypeInfo, 4) memcpy(table, lpVtbl.unpack('L').first, 80) table = table.unpack('L*') getRefTypeInfo = Win32::API::Function.new(table[14], 'PLP', 'L') p = 0.chr * 4 hr = getRefTypeInfo.call(pTypeInfo, pTypeDesc.unpack('L').first, p) pRefTypeInfo = p.unpack('L').first return nil if hr != S_OK bstr = 0.chr * 4 hr = ole_docinfo_from_type(pRefTypeInfo, bstr, nil, nil, nil) if hr != S_OK WIN32OLE.ole_release(pRefTypeInfo) return nil end WIN32OLE.ole_release(pRefTypeInfo) str = 0.chr * 256 wcscpy(str, bstr.unpack('L').first) type = wide_to_multi(str) if typedetails typedetails.push(type) end type end |
.progids ⇒ Object
2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 |
# File 'lib/win32ole-pr.rb', line 2829 def self.progids progids = [] hclsids = 0.chr * 4 err = WIN32OLE_TYPELIB.reg_open_key(HKEY_CLASSES_ROOT, "CLSID", hclsids) if err != ERROR_SUCCESS return progids end hclsids = hclsids.unpack('L').first i = 0 while true clsid = WIN32OLE_TYPELIB.reg_enum_key(hclsids, i) break if clsid.nil? hclsid = 0.chr * 4 err = WIN32OLE_TYPELIB.reg_open_vkey(hclsids, clsid, hclsid) if err != ERROR_SUCCESS i += 1 next end hclsid = hclsid.unpack('L').first if (v = WIN32OLE_TYPELIB.reg_get_val2(hclsid, "ProgID")) progids.push(v) end if (v = WIN32OLE_TYPELIB.reg_get_val2(hclsid, "VersionIndependentProgID")) progids.push(v) end RegCloseKey(hclsid); i += 1 end RegCloseKey(hclsids) progids end |
.typelibs ⇒ Object
2825 2826 2827 |
# File 'lib/win32ole-pr.rb', line 2825 def self.typelibs WIN32OLE_TYPELIB.typelibs.collect { |t| t.name } end |
Instance Method Details
#default_event_sources ⇒ Object
3435 3436 3437 |
# File 'lib/win32ole-pr.rb', line 3435 def default_event_sources ole_type_impl_ole_types(@pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT) end |
#default_ole_types ⇒ Object
3439 3440 3441 |
# File 'lib/win32ole-pr.rb', line 3439 def default_ole_types ole_type_impl_ole_types(@pTypeInfo, IMPLTYPEFLAG_FDEFAULT) end |
#guid ⇒ Object
2967 2968 2969 |
# File 'lib/win32ole-pr.rb', line 2967 def guid ole_type_guid(@pTypeInfo) end |
#helpcontext ⇒ Object
3315 3316 3317 |
# File 'lib/win32ole-pr.rb', line 3315 def helpcontext ole_type_helpcontext(@pTypeInfo) end |
#helpfile ⇒ Object
3304 3305 3306 |
# File 'lib/win32ole-pr.rb', line 3304 def helpfile ole_type_helpfile(@pTypeInfo) end |
#helpstring ⇒ Object
3137 3138 3139 |
# File 'lib/win32ole-pr.rb', line 3137 def helpstring WIN32OLE_TYPE.ole_type_helpstring(@pTypeInfo) end |
#implemented_ole_types ⇒ Object
3427 3428 3429 |
# File 'lib/win32ole-pr.rb', line 3427 def implemented_ole_types ole_type_impl_ole_types(@pTypeInfo, 0) end |
#inspect ⇒ Object
3443 3444 3445 |
# File 'lib/win32ole-pr.rb', line 3443 def inspect "#<#{self.class}:#{self.to_s}>" end |
#major_version ⇒ Object
3050 3051 3052 |
# File 'lib/win32ole-pr.rb', line 3050 def major_version ole_type_major_version(@pTypeInfo) end |
#minor_version ⇒ Object
3075 3076 3077 |
# File 'lib/win32ole-pr.rb', line 3075 def minor_version ole_type_minor_version(@pTypeInfo) end |
#name ⇒ Object Also known as: to_s
2891 2892 2893 |
# File 'lib/win32ole-pr.rb', line 2891 def name @name end |
#ole_methods ⇒ Object
3374 3375 3376 |
# File 'lib/win32ole-pr.rb', line 3374 def ole_methods WIN32OLE.ole_methods_from_typeinfo(@pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF) end |
#ole_ole_type(pTypeInfo) ⇒ Object
2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 |
# File 'lib/win32ole-pr.rb', line 2897 def ole_ole_type(pTypeInfo) type = 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') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) return type if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) typekind = typeAttr[40, 4].unpack('L').first case typekind when TKIND_ENUM type = "Enum" when TKIND_RECORD type = "Record" when TKIND_MODULE type = "Module" when TKIND_INTERFACE type = "Interface" when TKIND_DISPATCH type = "Dispatch" when TKIND_COCLASS type = "Class" when TKIND_ALIAS type = "Alias" when TKIND_UNION type = "Union" when TKIND_MAX type = "Max" else type = nil end releaseTypeAttr.call(pTypeInfo, pTypeAttr) type end |
#ole_type ⇒ Object
2939 2940 2941 |
# File 'lib/win32ole-pr.rb', line 2939 def ole_type ole_ole_type(@pTypeInfo) end |
#ole_type_guid(pTypeInfo) ⇒ Object
2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 |
# File 'lib/win32ole-pr.rb', line 2943 def ole_type_guid(pTypeInfo) guid = 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') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) return guid if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) bstr = 0.chr * 160 len = StringFromGUID2(typeAttr[0, 16], bstr, 80) if len > 3 guid = wide_to_multi(bstr) end releaseTypeAttr.call(pTypeInfo, pTypeAttr) guid end |
#ole_type_helpcontext(pTypeInfo) ⇒ Object
3308 3309 3310 3311 3312 3313 |
# File 'lib/win32ole-pr.rb', line 3308 def ole_type_helpcontext(pTypeInfo) helpcontext = 0.chr * 4 hr = WIN32OLE_TYPE.ole_docinfo_from_type(pTypeInfo, nil, nil, helpcontext, nil) return nil if hr != S_OK helpcontext.unpack('L').first end |
#ole_type_helpfile(pTypeInfo) ⇒ Object
3295 3296 3297 3298 3299 3300 3301 3302 |
# File 'lib/win32ole-pr.rb', line 3295 def ole_type_helpfile(pTypeInfo) bhelpfile = 0.chr * 4 hr = WIN32OLE_TYPE.ole_docinfo_from_type(pTypeInfo, 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_type_impl_ole_types(pTypeInfo, implflags) ⇒ Object
3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 |
# File 'lib/win32ole-pr.rb', line 3382 def ole_type_impl_ole_types(pTypeInfo, implflags) types = [] lpVtbl = 0.chr * 4 table = 0.chr * 80 memcpy(lpVtbl, pTypeInfo, 4) memcpy(table, lpVtbl.unpack('L').first, 80) table = table.unpack('L*') getTypeAttr = Win32::API::Function.new(table[3], 'PP', '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') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) pTypeAttr = p.unpack('L').first return types if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) 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 flags = flags.unpack('L').first 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 if (flgas & implflags) == implflags type = WIN32OLE.ole_type_from_itypeinfo(pRefTypeInfo) if type types.push(type) end end WIN32OLE.ole_release(pRefTypeInfo) end releaseTypeAttr(pTypeInfo, pTypeAttr) types end |
#ole_type_major_version(pTypeInfo) ⇒ Object
3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 |
# File 'lib/win32ole-pr.rb', line 3029 def ole_type_major_version(pTypeInfo) 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') 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 pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) ver = typeAttr[56, 2].unpack('S').first releaseTypeAttr.call(pTypeInfo, pTypeAttr) ver end |
#ole_type_minor_version(pTypeInfo) ⇒ Object
3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 |
# File 'lib/win32ole-pr.rb', line 3054 def ole_type_minor_version(pTypeInfo) 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') 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 pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) ver = typeAttr[58, 2].unpack('S').first releaseTypeAttr.call(pTypeInfo, pTypeAttr) ver end |
#ole_type_progid(pTypeInfo) ⇒ Object
2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 |
# File 'lib/win32ole-pr.rb', line 2971 def ole_type_progid(pTypeInfo) progid = 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') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) return progid if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) bstr = 0.chr * 4 hr = ProgIDFromCLSID(typeAttr[0, 16], bstr) if hr == S_OK str = 0.chr * 256 wcscpy(str, bstr.unpack('L').first) progid = wide_to_multi(str) CoTaskMemFree(bstr) end releaseTypeAttr.call(pTypeInfo, pTypeAttr) progid end |
#ole_type_src_type(pTypeInfo) ⇒ Object
3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 |
# File 'lib/win32ole-pr.rb', line 3265 def ole_type_src_type(pTypeInfo) _alias = 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') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) return _alias if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) typekind = typeAttr[40, 4].unpack('L').first if typekind != TKIND_ALIAS releaseTypeAttr.call(pTypeInfo, pTypeAttr) return _alias end _alias = WIN32OLE_TYPE.ole_typedesc2val(pTypeInfo, typeAttr[60, 8], nil) releaseTypeAttr.call(pTypeInfo, pTypeAttr) return _alias end |
#ole_type_typekind(pTypeInfo) ⇒ Object
3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 |
# File 'lib/win32ole-pr.rb', line 3079 def ole_type_typekind(pTypeInfo) 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') 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 pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) typekind = typeAttr[40, 4].unpack('L').first releaseTypeAttr.call(pTypeInfo, pTypeAttr) typekind end |
#ole_type_visible(pTypeInfo) ⇒ Object
3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 |
# File 'lib/win32ole-pr.rb', line 3002 def ole_type_visible(pTypeInfo) 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') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) return true if hr != S_OK pTypeAttr = p.unpack('L').first typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) if (typeAttr[54, 2].unpack('S').first & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) != 0 visible = false else visible = true end releaseTypeAttr.call(pTypeInfo, pTypeAttr) visible end |
#ole_typelib ⇒ Object
3378 3379 3380 |
# File 'lib/win32ole-pr.rb', line 3378 def ole_typelib WIN32OLE.ole_typelib_from_itypeinfo(@pTypeInfo) end |
#ole_variables(pTypeInfo) ⇒ Object
3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 |
# File 'lib/win32ole-pr.rb', line 3319 def ole_variables(pTypeInfo) variables = [] 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') getVarDesc = Win32::API::Function.new(table[6], 'PLP', 'L') getNames = Win32::API::Function.new(table[7], 'PLPLP', 'L') releaseTypeAttr = Win32::API::Function.new(table[19], 'PP', 'L') releaseVarDesc = Win32::API::Function.new(table[21], 'PP', 'L') p = 0.chr * 4 hr = getTypeAttr.call(pTypeInfo, p) pTypeAttr = p.unpack('L').first if hr != S_OK raise WIN32OLERuntimeError, "failed to GetTypeAttr" end typeAttr = 0.chr * 76 memcpy(typeAttr, pTypeAttr, 76) for i in 0 ... typeAttr[46, 2].unpack('S').first p = 0.chr * 4 getVarDesc.call(pTypeInfo, i, p) pVarDesc = p.unpack('L').first next if hr != S_OK varDesc = 0.chr * 36 memcpy(varDesc, pVarDesc, 36) bstr = 0.chr * 4 len = 0.chr * 4 hr = getNames.call(pTypeInfo, varDesc[0, 4].unpack('L').first, bstr, 1, len) if hr != S_OK || len.unpack('L').first == 0 || bstr.unpack('L').first == 0 next end var = WIN32OLE_VARIABLE.new var.pTypeInfo = pTypeInfo var.index = i bstr = bstr.unpack('L').first str = 0.chr * 256 wcscpy(str, bstr) SysFreeString(bstr) var.name = wide_to_multi(str) variables.push(var) releaseVarDesc.call(pTypeInfo, pVarDesc) pVarDesc = nil end releaseTypeAttr.call(pTypeInfo, pTypeAttr) variables end |
#oletype_set_member(pTypeInfo, name) ⇒ Object
2815 2816 2817 2818 2819 |
# File 'lib/win32ole-pr.rb', line 2815 def oletype_set_member(pTypeInfo, name) @name = name @pTypeInfo = pTypeInfo WIN32OLE.ole_addref(pTypeInfo) if pTypeInfo end |
#progid ⇒ Object
2998 2999 3000 |
# File 'lib/win32ole-pr.rb', line 2998 def progid ole_type_progid(@pTypeInfo) end |
#source_ole_types ⇒ Object
3431 3432 3433 |
# File 'lib/win32ole-pr.rb', line 3431 def source_ole_types ole_type_impl_ole_types(@pTypeInfo, IMPLTYPEFLAG_FSOURCE) end |
#src_type ⇒ Object
3291 3292 3293 |
# File 'lib/win32ole-pr.rb', line 3291 def src_type ole_type_src_type(@pTypeInfo) end |
#typekind ⇒ Object
3100 3101 3102 |
# File 'lib/win32ole-pr.rb', line 3100 def typekind ole_type_typekind(@pTypeInfo) end |
#variables ⇒ Object
3370 3371 3372 |
# File 'lib/win32ole-pr.rb', line 3370 def variables ole_variables(@pTypeInfo) end |
#visible? ⇒ Boolean
3025 3026 3027 |
# File 'lib/win32ole-pr.rb', line 3025 def visible? ole_type_visible(@pTypeInfo) end |