win32ole 1.8.9 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +4 -0
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/ext/win32ole/.document +1 -0
- data/ext/win32ole/win32ole.c +70 -134
- data/ext/win32ole/win32ole_error.c +13 -4
- data/ext/win32ole/win32ole_event.c +26 -25
- data/ext/win32ole/win32ole_method.c +64 -63
- data/ext/win32ole/win32ole_param.c +57 -56
- data/ext/win32ole/win32ole_record.c +26 -25
- data/ext/win32ole/win32ole_type.c +73 -69
- data/ext/win32ole/win32ole_typelib.c +38 -37
- data/ext/win32ole/win32ole_variable.c +19 -18
- data/ext/win32ole/win32ole_variant.c +34 -33
- data/ext/win32ole/win32ole_variant_m.c +7 -5
- data/lib/win32ole/property.rb +15 -3
- data/lib/win32ole.rb +1 -2
- data/{ext/win32ole/sample → sample/win32ole}/olegen.rb +2 -2
- metadata +22 -31
- data/.git-blame-ignore-revs +0 -7
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/windows.yml +0 -24
- data/.gitignore +0 -8
- data/Gemfile +0 -7
- data/Rakefile +0 -19
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/rakelib/changelogs.rake +0 -34
- data/rakelib/epoch.rake +0 -5
- data/rakelib/sync_tool.rake +0 -6
- data/rakelib/version.rake +0 -45
- data/win32ole.gemspec +0 -22
- /data/{ext/win32ole/sample → sample/win32ole}/excel1.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/excel2.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/excel3.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/ie.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/ieconst.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/ienavi.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/ienavi2.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/oledirs.rb +0 -0
- /data/{ext/win32ole/sample → sample/win32ole}/xml.rb +0 -0
@@ -64,9 +64,9 @@ create_win32ole_param(ITypeInfo *pTypeInfo, UINT method_index, UINT index, VALUE
|
|
64
64
|
}
|
65
65
|
|
66
66
|
/*
|
67
|
-
* Document-class:
|
67
|
+
* Document-class: WIN32OLE::Param
|
68
68
|
*
|
69
|
-
*
|
69
|
+
* +WIN32OLE::Param+ objects represent param information of
|
70
70
|
* the OLE method.
|
71
71
|
*/
|
72
72
|
static VALUE
|
@@ -131,15 +131,15 @@ oleparam_ole_param(VALUE self, VALUE olemethod, int n)
|
|
131
131
|
|
132
132
|
/*
|
133
133
|
* call-seq:
|
134
|
-
*
|
134
|
+
* new(method, n) -> WIN32OLE::Param object
|
135
135
|
*
|
136
|
-
* Returns
|
137
|
-
* 1st argument should be
|
136
|
+
* Returns WIN32OLE::Param object which represents OLE parameter information.
|
137
|
+
* 1st argument should be WIN32OLE::Method object.
|
138
138
|
* 2nd argument `n' is n-th parameter of the method specified by 1st argument.
|
139
139
|
*
|
140
|
-
* tobj =
|
141
|
-
* method =
|
142
|
-
* param =
|
140
|
+
* tobj = WIN32OLE::Type.new('Microsoft Scripting Runtime', 'IFileSystem')
|
141
|
+
* method = WIN32OLE::Method.new(tobj, 'CreateTextFile')
|
142
|
+
* param = WIN32OLE::Param.new(method, 2) # => #<WIN32OLE::Param:Overwrite=true>
|
143
143
|
*
|
144
144
|
*/
|
145
145
|
static VALUE
|
@@ -147,7 +147,7 @@ foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
|
|
147
147
|
{
|
148
148
|
int idx;
|
149
149
|
if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) {
|
150
|
-
rb_raise(rb_eTypeError, "1st parameter must be
|
150
|
+
rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE::Method object");
|
151
151
|
}
|
152
152
|
idx = RB_FIX2INT(n);
|
153
153
|
return oleparam_ole_param(self, olemethod, idx);
|
@@ -155,11 +155,11 @@ foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
|
|
155
155
|
|
156
156
|
/*
|
157
157
|
* call-seq:
|
158
|
-
*
|
158
|
+
* name
|
159
159
|
*
|
160
160
|
* Returns name.
|
161
|
-
* tobj =
|
162
|
-
* method =
|
161
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
|
162
|
+
* method = WIN32OLE::Method.new(tobj, 'SaveAs')
|
163
163
|
* param1 = method.params[0]
|
164
164
|
* puts param1.name # => Filename
|
165
165
|
*/
|
@@ -186,11 +186,11 @@ ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
|
|
186
186
|
|
187
187
|
/*
|
188
188
|
* call-seq:
|
189
|
-
*
|
189
|
+
* ole_type
|
190
190
|
*
|
191
|
-
* Returns OLE type of
|
192
|
-
* tobj =
|
193
|
-
* method =
|
191
|
+
* Returns OLE type of WIN32OLE::Param object(parameter of OLE method).
|
192
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
|
193
|
+
* method = WIN32OLE::Method.new(tobj, 'SaveAs')
|
194
194
|
* param1 = method.params[0]
|
195
195
|
* puts param1.ole_type # => VARIANT
|
196
196
|
*/
|
@@ -220,11 +220,11 @@ ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
|
|
220
220
|
|
221
221
|
/*
|
222
222
|
* call-seq:
|
223
|
-
*
|
223
|
+
* ole_type_detail
|
224
224
|
*
|
225
225
|
* Returns detail information of type of argument.
|
226
|
-
* tobj =
|
227
|
-
* method =
|
226
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
|
227
|
+
* method = WIN32OLE::Method.new(tobj, 'SumIf')
|
228
228
|
* param1 = method.params[0]
|
229
229
|
* p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
|
230
230
|
*/
|
@@ -254,11 +254,11 @@ ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT
|
|
254
254
|
|
255
255
|
/*
|
256
256
|
* call-seq:
|
257
|
-
*
|
257
|
+
* input?
|
258
258
|
*
|
259
259
|
* Returns true if the parameter is input.
|
260
|
-
* tobj =
|
261
|
-
* method =
|
260
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
|
261
|
+
* method = WIN32OLE::Method.new(tobj, 'SaveAs')
|
262
262
|
* param1 = method.params[0]
|
263
263
|
* puts param1.input? # => true
|
264
264
|
*/
|
@@ -273,22 +273,22 @@ foleparam_input(VALUE self)
|
|
273
273
|
|
274
274
|
/*
|
275
275
|
* call-seq:
|
276
|
-
*
|
276
|
+
* output?
|
277
277
|
*
|
278
278
|
* Returns true if argument is output.
|
279
|
-
* tobj =
|
280
|
-
* method =
|
279
|
+
* tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'DWebBrowserEvents')
|
280
|
+
* method = WIN32OLE::Method.new(tobj, 'NewWindow')
|
281
281
|
* method.params.each do |param|
|
282
282
|
* puts "#{param.name} #{param.output?}"
|
283
283
|
* end
|
284
284
|
*
|
285
|
-
*
|
286
|
-
*
|
287
|
-
*
|
288
|
-
*
|
289
|
-
*
|
290
|
-
*
|
291
|
-
*
|
285
|
+
* The result of above script is following:
|
286
|
+
* URL false
|
287
|
+
* Flags false
|
288
|
+
* TargetFrameName false
|
289
|
+
* PostData false
|
290
|
+
* Headers false
|
291
|
+
* Processed true
|
292
292
|
*/
|
293
293
|
static VALUE
|
294
294
|
foleparam_output(VALUE self)
|
@@ -301,11 +301,11 @@ foleparam_output(VALUE self)
|
|
301
301
|
|
302
302
|
/*
|
303
303
|
* call-seq:
|
304
|
-
*
|
304
|
+
* optional?
|
305
305
|
*
|
306
306
|
* Returns true if argument is optional.
|
307
|
-
* tobj =
|
308
|
-
* method =
|
307
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
|
308
|
+
* method = WIN32OLE::Method.new(tobj, 'SaveAs')
|
309
309
|
* param1 = method.params[0]
|
310
310
|
* puts "#{param1.name} #{param1.optional?}" # => Filename true
|
311
311
|
*/
|
@@ -320,12 +320,12 @@ foleparam_optional(VALUE self)
|
|
320
320
|
|
321
321
|
/*
|
322
322
|
* call-seq:
|
323
|
-
*
|
323
|
+
* retval?
|
324
324
|
*
|
325
325
|
* Returns true if argument is return value.
|
326
|
-
* tobj =
|
327
|
-
*
|
328
|
-
* method =
|
326
|
+
* tobj = WIN32OLE::Type.new('DirectX 7 for Visual Basic Type Library',
|
327
|
+
* 'DirectPlayLobbyConnection')
|
328
|
+
* method = WIN32OLE::Method.new(tobj, 'GetPlayerShortName')
|
329
329
|
* param = method.params[0]
|
330
330
|
* puts "#{param.name} #{param.retval?}" # => name true
|
331
331
|
*/
|
@@ -363,12 +363,12 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
|
|
363
363
|
|
364
364
|
/*
|
365
365
|
* call-seq:
|
366
|
-
*
|
366
|
+
* default
|
367
367
|
*
|
368
368
|
* Returns default value. If the default value does not exist,
|
369
369
|
* this method returns nil.
|
370
|
-
* tobj =
|
371
|
-
* method =
|
370
|
+
* tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
|
371
|
+
* method = WIN32OLE::Method.new(tobj, 'SaveAs')
|
372
372
|
* method.params.each do |param|
|
373
373
|
* if param.default
|
374
374
|
* puts "#{param.name} (= #{param.default})"
|
@@ -377,18 +377,18 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
|
|
377
377
|
* end
|
378
378
|
* end
|
379
379
|
*
|
380
|
-
*
|
381
|
-
*
|
382
|
-
*
|
383
|
-
*
|
384
|
-
*
|
385
|
-
*
|
386
|
-
*
|
387
|
-
*
|
388
|
-
*
|
389
|
-
*
|
390
|
-
*
|
391
|
-
*
|
380
|
+
* The above script result is following:
|
381
|
+
* Filename
|
382
|
+
* FileFormat
|
383
|
+
* Password
|
384
|
+
* WriteResPassword
|
385
|
+
* ReadOnlyRecommended
|
386
|
+
* CreateBackup
|
387
|
+
* AccessMode (= 1)
|
388
|
+
* ConflictResolution
|
389
|
+
* AddToMru
|
390
|
+
* TextCodepage
|
391
|
+
* TextVisualLayout
|
392
392
|
*/
|
393
393
|
static VALUE
|
394
394
|
foleparam_default(VALUE self)
|
@@ -401,7 +401,7 @@ foleparam_default(VALUE self)
|
|
401
401
|
|
402
402
|
/*
|
403
403
|
* call-seq:
|
404
|
-
*
|
404
|
+
* inspect -> String
|
405
405
|
*
|
406
406
|
* Returns the parameter name with class name. If the parameter has default value,
|
407
407
|
* then returns name=value string with class name.
|
@@ -416,13 +416,14 @@ foleparam_inspect(VALUE self)
|
|
416
416
|
rb_str_cat2(detail, "=");
|
417
417
|
rb_str_concat(detail, rb_inspect(defval));
|
418
418
|
}
|
419
|
-
return make_inspect("
|
419
|
+
return make_inspect("WIN32OLE::Param", detail);
|
420
420
|
}
|
421
421
|
|
422
422
|
void
|
423
423
|
Init_win32ole_param(void)
|
424
424
|
{
|
425
425
|
cWIN32OLE_PARAM = rb_define_class_under(cWIN32OLE, "Param", rb_cObject);
|
426
|
+
/* Alias of WIN32OLE::Param, for the backward compatibility */
|
426
427
|
rb_define_const(rb_cObject, "WIN32OLE_PARAM", cWIN32OLE_PARAM);
|
427
428
|
rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate);
|
428
429
|
rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2);
|
@@ -177,10 +177,10 @@ create_win32ole_record(IRecordInfo *pri, void *prec)
|
|
177
177
|
}
|
178
178
|
|
179
179
|
/*
|
180
|
-
* Document-class:
|
180
|
+
* Document-class: WIN32OLE::Record
|
181
181
|
*
|
182
|
-
*
|
183
|
-
* Win32OLE returns
|
182
|
+
* +WIN32OLE::Record+ objects represents VT_RECORD OLE variant.
|
183
|
+
* Win32OLE returns WIN32OLE::Record object if the result value of invoking
|
184
184
|
* OLE methods.
|
185
185
|
*
|
186
186
|
* If COM server in VB.NET ComServer project is the following:
|
@@ -206,7 +206,7 @@ create_win32ole_record(IRecordInfo *pri, void *prec)
|
|
206
206
|
* require 'win32ole'
|
207
207
|
* obj = WIN32OLE.new('ComServer.ComClass')
|
208
208
|
* book = obj.getBook
|
209
|
-
* book.class # =>
|
209
|
+
* book.class # => WIN32OLE::Record
|
210
210
|
* book.title # => "The Ruby Book"
|
211
211
|
* book.cost # => 20
|
212
212
|
*
|
@@ -253,11 +253,11 @@ folerecord_s_allocate(VALUE klass) {
|
|
253
253
|
|
254
254
|
/*
|
255
255
|
* call-seq:
|
256
|
-
*
|
256
|
+
* new(typename, obj) -> WIN32OLE::Record object
|
257
257
|
*
|
258
|
-
* Returns
|
258
|
+
* Returns WIN32OLE::Record object. The first argument is struct name (String
|
259
259
|
* or Symbol).
|
260
|
-
* The second parameter obj should be WIN32OLE object or
|
260
|
+
* The second parameter obj should be WIN32OLE object or WIN32OLE::TypeLib object.
|
261
261
|
* If COM server in VB.NET ComServer project is the following:
|
262
262
|
*
|
263
263
|
* Imports System.Runtime.InteropServices
|
@@ -269,13 +269,13 @@ folerecord_s_allocate(VALUE klass) {
|
|
269
269
|
* End Structure
|
270
270
|
* End Class
|
271
271
|
*
|
272
|
-
* then, you can create
|
272
|
+
* then, you can create WIN32OLE::Record object is as following:
|
273
273
|
*
|
274
274
|
* require 'win32ole'
|
275
275
|
* obj = WIN32OLE.new('ComServer.ComClass')
|
276
|
-
* book1 =
|
276
|
+
* book1 = WIN32OLE::Record.new('Book', obj) # => WIN32OLE::Record object
|
277
277
|
* tlib = obj.ole_typelib
|
278
|
-
* book2 =
|
278
|
+
* book2 = WIN32OLE::Record.new('Book', tlib) # => WIN32OLE::Record object
|
279
279
|
*
|
280
280
|
*/
|
281
281
|
static VALUE
|
@@ -303,7 +303,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) {
|
|
303
303
|
hr = E_FAIL;
|
304
304
|
}
|
305
305
|
} else {
|
306
|
-
rb_raise(rb_eArgError, "2nd argument should be WIN32OLE object or
|
306
|
+
rb_raise(rb_eArgError, "2nd argument should be WIN32OLE object or WIN32OLE::TypeLib object");
|
307
307
|
}
|
308
308
|
|
309
309
|
if (FAILED(hr)) {
|
@@ -323,7 +323,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) {
|
|
323
323
|
|
324
324
|
/*
|
325
325
|
* call-seq:
|
326
|
-
*
|
326
|
+
* WIN32OLE::Record#to_h #=> Ruby Hash object.
|
327
327
|
*
|
328
328
|
* Returns Ruby Hash object which represents VT_RECORD variable.
|
329
329
|
* The keys of Hash object are member names of VT_RECORD OLE variable and
|
@@ -346,7 +346,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) {
|
|
346
346
|
* End Function
|
347
347
|
* End Class
|
348
348
|
*
|
349
|
-
* then, the result of
|
349
|
+
* then, the result of WIN32OLE::Record#to_h is the following:
|
350
350
|
*
|
351
351
|
* require 'win32ole'
|
352
352
|
* obj = WIN32OLE.new('ComServer.ComClass')
|
@@ -362,7 +362,7 @@ folerecord_to_h(VALUE self)
|
|
362
362
|
|
363
363
|
/*
|
364
364
|
* call-seq:
|
365
|
-
*
|
365
|
+
* typename #=> String object
|
366
366
|
*
|
367
367
|
* Returns the type name of VT_RECORD OLE variable.
|
368
368
|
*
|
@@ -383,7 +383,7 @@ folerecord_to_h(VALUE self)
|
|
383
383
|
* End Function
|
384
384
|
* End Class
|
385
385
|
*
|
386
|
-
* then, the result of
|
386
|
+
* then, the result of WIN32OLE::Record#typename is the following:
|
387
387
|
*
|
388
388
|
* require 'win32ole'
|
389
389
|
* obj = WIN32OLE.new('ComServer.ComClass')
|
@@ -423,7 +423,7 @@ olerecord_ivar_set(VALUE self, VALUE name, VALUE val)
|
|
423
423
|
|
424
424
|
/*
|
425
425
|
* call-seq:
|
426
|
-
*
|
426
|
+
* method_missing(name)
|
427
427
|
*
|
428
428
|
* Returns value specified by the member name of VT_RECORD OLE variable.
|
429
429
|
* Or sets value specified by the member name of VT_RECORD OLE variable.
|
@@ -443,7 +443,7 @@ olerecord_ivar_set(VALUE self, VALUE name, VALUE val)
|
|
443
443
|
* Then getting/setting value from Ruby is as the following:
|
444
444
|
*
|
445
445
|
* obj = WIN32OLE.new('ComServer.ComClass')
|
446
|
-
* book =
|
446
|
+
* book = WIN32OLE::Record.new('Book', obj)
|
447
447
|
* book.title # => nil ( book.method_missing(:title) is invoked. )
|
448
448
|
* book.title = "Ruby" # ( book.method_missing(:title=, "Ruby") is invoked. )
|
449
449
|
*/
|
@@ -473,7 +473,7 @@ folerecord_method_missing(int argc, VALUE *argv, VALUE self)
|
|
473
473
|
|
474
474
|
/*
|
475
475
|
* call-seq:
|
476
|
-
*
|
476
|
+
* ole_instance_variable_get(name)
|
477
477
|
*
|
478
478
|
* Returns value specified by the member name of VT_RECORD OLE object.
|
479
479
|
* If the member name is not correct, KeyError exception is raised.
|
@@ -494,7 +494,7 @@ folerecord_method_missing(int argc, VALUE *argv, VALUE self)
|
|
494
494
|
* then accessing object_id of ComObject from Ruby is as the following:
|
495
495
|
*
|
496
496
|
* srver = WIN32OLE.new('ComServer.ComClass')
|
497
|
-
* obj =
|
497
|
+
* obj = WIN32OLE::Record.new('ComObject', server)
|
498
498
|
* # obj.object_id returns Ruby Object#object_id
|
499
499
|
* obj.ole_instance_variable_get(:object_id) # => nil
|
500
500
|
*
|
@@ -515,7 +515,7 @@ folerecord_ole_instance_variable_get(VALUE self, VALUE name)
|
|
515
515
|
|
516
516
|
/*
|
517
517
|
* call-seq:
|
518
|
-
*
|
518
|
+
* ole_instance_variable_set(name, val)
|
519
519
|
*
|
520
520
|
* Sets value specified by the member name of VT_RECORD OLE object.
|
521
521
|
* If the member name is not correct, KeyError exception is raised.
|
@@ -534,7 +534,7 @@ folerecord_ole_instance_variable_get(VALUE self, VALUE name)
|
|
534
534
|
* then setting value of the `title' member is as following:
|
535
535
|
*
|
536
536
|
* srver = WIN32OLE.new('ComServer.ComClass')
|
537
|
-
* obj =
|
537
|
+
* obj = WIN32OLE::Record.new('Book', server)
|
538
538
|
* obj.ole_instance_variable_set(:title, "The Ruby Book")
|
539
539
|
*
|
540
540
|
*/
|
@@ -554,7 +554,7 @@ folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val)
|
|
554
554
|
|
555
555
|
/*
|
556
556
|
* call-seq:
|
557
|
-
*
|
557
|
+
* inspect -> String
|
558
558
|
*
|
559
559
|
* Returns the OLE struct name and member name and the value of member
|
560
560
|
*
|
@@ -570,8 +570,8 @@ folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val)
|
|
570
570
|
* then
|
571
571
|
*
|
572
572
|
* srver = WIN32OLE.new('ComServer.ComClass')
|
573
|
-
* obj =
|
574
|
-
* obj.inspect # => <
|
573
|
+
* obj = WIN32OLE::Record.new('Book', server)
|
574
|
+
* obj.inspect # => <WIN32OLE::Record(ComClass) {"title" => nil, "cost" => nil}>
|
575
575
|
*
|
576
576
|
*/
|
577
577
|
static VALUE
|
@@ -584,7 +584,7 @@ folerecord_inspect(VALUE self)
|
|
584
584
|
tname = rb_inspect(tname);
|
585
585
|
}
|
586
586
|
field = rb_inspect(folerecord_to_h(self));
|
587
|
-
return rb_sprintf("#<
|
587
|
+
return rb_sprintf("#<WIN32OLE::Record(%"PRIsVALUE") %"PRIsVALUE">",
|
588
588
|
tname,
|
589
589
|
field);
|
590
590
|
}
|
@@ -595,6 +595,7 @@ void
|
|
595
595
|
Init_win32ole_record(void)
|
596
596
|
{
|
597
597
|
cWIN32OLE_RECORD = rb_define_class_under(cWIN32OLE, "Record", rb_cObject);
|
598
|
+
/* Alias of WIN32OLE::Record, for the backward compatibility */
|
598
599
|
rb_define_const(rb_cObject, "WIN32OLE_RECORD", cWIN32OLE_RECORD);
|
599
600
|
rb_define_alloc_func(cWIN32OLE_RECORD, folerecord_s_allocate);
|
600
601
|
rb_define_method(cWIN32OLE_RECORD, "initialize", folerecord_initialize, 2);
|