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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c9eb6d552cac131c2a19f600e387a50d40e69cc07dcca4d481e697509ea3689
|
4
|
+
data.tar.gz: 1c0adf4ba2890d7b4cb072dd50eccf7a1978e6fc57dfb1100d71278b0a6271b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ffef61b6ab22005a27ddaeb2e1f6a85f994494d43899348573976a862c7deea5221430f6bb0539f9e9ccee1faf4e0ba86db1fc4c734d70bd1901ec3625977f9
|
7
|
+
data.tar.gz: e16cb7c1312b3654fde7f653368372262f786eba624d068196b0aea91419148ad212c3f9ac24b0cae12f8bbff3ca5b6769011292f18915da45ffed34ca688714
|
data/.document
ADDED
data/{LICENSE.txt → BSDL}
RENAMED
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
|
|
4
4
|
modification, are permitted provided that the following conditions
|
5
5
|
are met:
|
6
6
|
1. Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
8
|
2. Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
11
|
|
12
12
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
13
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
data/COPYING
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
@@ -0,0 +1 @@
|
|
1
|
+
*.[ch]
|
data/ext/win32ole/win32ole.c
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
|
28
28
|
#endif
|
29
29
|
|
30
|
-
#define WIN32OLE_VERSION "1.
|
30
|
+
#define WIN32OLE_VERSION "1.9.0"
|
31
31
|
|
32
32
|
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
33
33
|
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
@@ -1426,9 +1426,10 @@ ole_variant2val(VARIANT *pvar)
|
|
1426
1426
|
vt = V_VT(pvar);
|
1427
1427
|
}
|
1428
1428
|
|
1429
|
+
#define ARG_AS(type, pvar) (V_ISBYREF(pvar) ? *V_##type##REF(pvar) : V_##type(pvar))
|
1429
1430
|
if(V_ISARRAY(pvar)) {
|
1430
1431
|
VARTYPE vt_base = vt & VT_TYPEMASK;
|
1431
|
-
SAFEARRAY *psa =
|
1432
|
+
SAFEARRAY *psa = ARG_AS(ARRAY, pvar);
|
1432
1433
|
UINT i = 0;
|
1433
1434
|
LONG *pid, *plb, *pub;
|
1434
1435
|
VARIANT variant;
|
@@ -1495,109 +1496,58 @@ ole_variant2val(VARIANT *pvar)
|
|
1495
1496
|
case VT_NULL:
|
1496
1497
|
break;
|
1497
1498
|
case VT_I1:
|
1498
|
-
|
1499
|
-
obj = RB_INT2NUM((long)*V_I1REF(pvar));
|
1500
|
-
else
|
1501
|
-
obj = RB_INT2NUM((long)V_I1(pvar));
|
1499
|
+
obj = RB_INT2NUM((long)ARG_AS(I1, pvar));
|
1502
1500
|
break;
|
1503
1501
|
|
1504
1502
|
case VT_UI1:
|
1505
|
-
|
1506
|
-
obj = RB_INT2NUM((long)*V_UI1REF(pvar));
|
1507
|
-
else
|
1508
|
-
obj = RB_INT2NUM((long)V_UI1(pvar));
|
1503
|
+
obj = RB_INT2NUM((long)ARG_AS(UI1, pvar));
|
1509
1504
|
break;
|
1510
1505
|
|
1511
1506
|
case VT_I2:
|
1512
|
-
|
1513
|
-
obj = RB_INT2NUM((long)*V_I2REF(pvar));
|
1514
|
-
else
|
1515
|
-
obj = RB_INT2NUM((long)V_I2(pvar));
|
1507
|
+
obj = RB_INT2NUM((long)ARG_AS(I2, pvar));
|
1516
1508
|
break;
|
1517
1509
|
|
1518
1510
|
case VT_UI2:
|
1519
|
-
|
1520
|
-
obj = RB_INT2NUM((long)*V_UI2REF(pvar));
|
1521
|
-
else
|
1522
|
-
obj = RB_INT2NUM((long)V_UI2(pvar));
|
1511
|
+
obj = RB_INT2NUM((long)ARG_AS(UI2, pvar));
|
1523
1512
|
break;
|
1524
1513
|
|
1525
1514
|
case VT_I4:
|
1526
|
-
|
1527
|
-
obj = RB_INT2NUM((long)*V_I4REF(pvar));
|
1528
|
-
else
|
1529
|
-
obj = RB_INT2NUM((long)V_I4(pvar));
|
1515
|
+
obj = RB_INT2NUM((long)ARG_AS(I4, pvar));
|
1530
1516
|
break;
|
1531
1517
|
|
1532
1518
|
case VT_UI4:
|
1533
|
-
|
1534
|
-
obj = RB_INT2NUM((long)*V_UI4REF(pvar));
|
1535
|
-
else
|
1536
|
-
obj = RB_INT2NUM((long)V_UI4(pvar));
|
1519
|
+
obj = RB_INT2NUM((long)ARG_AS(UI4, pvar));
|
1537
1520
|
break;
|
1538
1521
|
|
1539
1522
|
case VT_INT:
|
1540
|
-
|
1541
|
-
obj = RB_INT2NUM((long)*V_INTREF(pvar));
|
1542
|
-
else
|
1543
|
-
obj = RB_INT2NUM((long)V_INT(pvar));
|
1523
|
+
obj = RB_INT2NUM((long)ARG_AS(INT, pvar));
|
1544
1524
|
break;
|
1545
1525
|
|
1546
1526
|
case VT_UINT:
|
1547
|
-
|
1548
|
-
obj = RB_INT2NUM((long)*V_UINTREF(pvar));
|
1549
|
-
else
|
1550
|
-
obj = RB_INT2NUM((long)V_UINT(pvar));
|
1527
|
+
obj = RB_INT2NUM((long)ARG_AS(UINT, pvar));
|
1551
1528
|
break;
|
1552
1529
|
|
1553
1530
|
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1554
1531
|
case VT_I8:
|
1555
|
-
|
1556
|
-
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1557
|
-
#ifdef V_I8REF
|
1558
|
-
obj = I8_2_NUM(*V_I8REF(pvar));
|
1559
|
-
#endif
|
1560
|
-
#else
|
1561
|
-
obj = Qnil;
|
1562
|
-
#endif
|
1563
|
-
else
|
1564
|
-
obj = I8_2_NUM(V_I8(pvar));
|
1532
|
+
obj = I8_2_NUM(ARG_AS(I8, pvar));
|
1565
1533
|
break;
|
1566
1534
|
case VT_UI8:
|
1567
|
-
|
1568
|
-
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1569
|
-
#ifdef V_UI8REF
|
1570
|
-
obj = UI8_2_NUM(*V_UI8REF(pvar));
|
1571
|
-
#endif
|
1572
|
-
#else
|
1573
|
-
obj = Qnil;
|
1574
|
-
#endif
|
1575
|
-
else
|
1576
|
-
obj = UI8_2_NUM(V_UI8(pvar));
|
1535
|
+
obj = UI8_2_NUM(ARG_AS(UI8, pvar));
|
1577
1536
|
break;
|
1578
1537
|
#endif /* (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__) */
|
1579
1538
|
|
1580
1539
|
case VT_R4:
|
1581
|
-
|
1582
|
-
obj = rb_float_new(*V_R4REF(pvar));
|
1583
|
-
else
|
1584
|
-
obj = rb_float_new(V_R4(pvar));
|
1540
|
+
obj = rb_float_new(ARG_AS(R4, pvar));
|
1585
1541
|
break;
|
1586
1542
|
|
1587
1543
|
case VT_R8:
|
1588
|
-
|
1589
|
-
obj = rb_float_new(*V_R8REF(pvar));
|
1590
|
-
else
|
1591
|
-
obj = rb_float_new(V_R8(pvar));
|
1544
|
+
obj = rb_float_new(ARG_AS(R8, pvar));
|
1592
1545
|
break;
|
1593
1546
|
|
1594
1547
|
case VT_BSTR:
|
1595
1548
|
{
|
1596
1549
|
BSTR bstr;
|
1597
|
-
|
1598
|
-
bstr = *V_BSTRREF(pvar);
|
1599
|
-
else
|
1600
|
-
bstr = V_BSTR(pvar);
|
1550
|
+
bstr = ARG_AS(BSTR, pvar);
|
1601
1551
|
obj = (SysStringLen(bstr) == 0)
|
1602
1552
|
? rb_str_new2("")
|
1603
1553
|
: ole_wc2vstr(bstr, FALSE);
|
@@ -1605,27 +1555,18 @@ ole_variant2val(VARIANT *pvar)
|
|
1605
1555
|
}
|
1606
1556
|
|
1607
1557
|
case VT_ERROR:
|
1608
|
-
|
1609
|
-
obj = RB_INT2NUM(*V_ERRORREF(pvar));
|
1610
|
-
else
|
1611
|
-
obj = RB_INT2NUM(V_ERROR(pvar));
|
1558
|
+
obj = RB_INT2NUM(ARG_AS(ERROR, pvar));
|
1612
1559
|
break;
|
1613
1560
|
|
1614
1561
|
case VT_BOOL:
|
1615
|
-
|
1616
|
-
obj = (*V_BOOLREF(pvar) ? Qtrue : Qfalse);
|
1617
|
-
else
|
1618
|
-
obj = (V_BOOL(pvar) ? Qtrue : Qfalse);
|
1562
|
+
obj = (ARG_AS(BOOL, pvar) ? Qtrue : Qfalse);
|
1619
1563
|
break;
|
1620
1564
|
|
1621
1565
|
case VT_DISPATCH:
|
1622
1566
|
{
|
1623
1567
|
IDispatch *pDispatch;
|
1624
1568
|
|
1625
|
-
|
1626
|
-
pDispatch = *V_DISPATCHREF(pvar);
|
1627
|
-
else
|
1628
|
-
pDispatch = V_DISPATCH(pvar);
|
1569
|
+
pDispatch = ARG_AS(DISPATCH, pvar);
|
1629
1570
|
|
1630
1571
|
if (pDispatch != NULL ) {
|
1631
1572
|
OLE_ADDREF(pDispatch);
|
@@ -1642,10 +1583,7 @@ ole_variant2val(VARIANT *pvar)
|
|
1642
1583
|
void *p;
|
1643
1584
|
HRESULT hr;
|
1644
1585
|
|
1645
|
-
|
1646
|
-
punk = *V_UNKNOWNREF(pvar);
|
1647
|
-
else
|
1648
|
-
punk = V_UNKNOWN(pvar);
|
1586
|
+
punk = ARG_AS(UNKNOWN, pvar);
|
1649
1587
|
|
1650
1588
|
if(punk != NULL) {
|
1651
1589
|
hr = punk->lpVtbl->QueryInterface(punk, &IID_IDispatch, &p);
|
@@ -1660,10 +1598,7 @@ ole_variant2val(VARIANT *pvar)
|
|
1660
1598
|
case VT_DATE:
|
1661
1599
|
{
|
1662
1600
|
DATE date;
|
1663
|
-
|
1664
|
-
date = *V_DATEREF(pvar);
|
1665
|
-
else
|
1666
|
-
date = V_DATE(pvar);
|
1601
|
+
date = ARG_AS(DATE, pvar);
|
1667
1602
|
|
1668
1603
|
obj = vtdate2rbtime(date);
|
1669
1604
|
break;
|
@@ -1693,6 +1628,7 @@ ole_variant2val(VARIANT *pvar)
|
|
1693
1628
|
}
|
1694
1629
|
}
|
1695
1630
|
return obj;
|
1631
|
+
#undef ARG_AS
|
1696
1632
|
}
|
1697
1633
|
|
1698
1634
|
LONG
|
@@ -1962,7 +1898,7 @@ ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self)
|
|
1962
1898
|
|
1963
1899
|
/*
|
1964
1900
|
* call-seq:
|
1965
|
-
*
|
1901
|
+
* connect(ole) --> aWIN32OLE
|
1966
1902
|
*
|
1967
1903
|
* Returns running OLE Automation object or WIN32OLE object from moniker.
|
1968
1904
|
* 1st argument should be OLE program id or class id or moniker.
|
@@ -2019,7 +1955,7 @@ fole_s_connect(int argc, VALUE *argv, VALUE self)
|
|
2019
1955
|
|
2020
1956
|
/*
|
2021
1957
|
* call-seq:
|
2022
|
-
*
|
1958
|
+
* const_load(ole, mod = WIN32OLE)
|
2023
1959
|
*
|
2024
1960
|
* Defines the constants of OLE Automation server as mod's constants.
|
2025
1961
|
* The first argument is WIN32OLE object or type library name.
|
@@ -2124,7 +2060,7 @@ reference_count(struct oledata * pole)
|
|
2124
2060
|
|
2125
2061
|
/*
|
2126
2062
|
* call-seq:
|
2127
|
-
*
|
2063
|
+
* ole_reference_count(aWIN32OLE) --> number
|
2128
2064
|
*
|
2129
2065
|
* Returns reference counter of Dispatch interface of WIN32OLE object.
|
2130
2066
|
* You should not use this method because this method
|
@@ -2140,7 +2076,7 @@ fole_s_reference_count(VALUE self, VALUE obj)
|
|
2140
2076
|
|
2141
2077
|
/*
|
2142
2078
|
* call-seq:
|
2143
|
-
*
|
2079
|
+
* ole_free(aWIN32OLE) --> number
|
2144
2080
|
*
|
2145
2081
|
* Invokes Release method of Dispatch interface of WIN32OLE object.
|
2146
2082
|
* You should not use this method because this method
|
@@ -2184,10 +2120,10 @@ ole_show_help(VALUE helpfile, VALUE helpcontext)
|
|
2184
2120
|
|
2185
2121
|
/*
|
2186
2122
|
* call-seq:
|
2187
|
-
*
|
2123
|
+
* ole_show_help(obj [,helpcontext])
|
2188
2124
|
*
|
2189
|
-
* Displays helpfile. The 1st argument specifies
|
2190
|
-
* object or
|
2125
|
+
* Displays helpfile. The 1st argument specifies WIN32OLE::Type
|
2126
|
+
* object or WIN32OLE::Method object or helpfile.
|
2191
2127
|
*
|
2192
2128
|
* excel = WIN32OLE.new('Excel.Application')
|
2193
2129
|
* typeobj = excel.ole_type
|
@@ -2215,7 +2151,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self)
|
|
2215
2151
|
helpfile = target;
|
2216
2152
|
}
|
2217
2153
|
if (!RB_TYPE_P(helpfile, T_STRING)) {
|
2218
|
-
rb_raise(rb_eTypeError, "1st parameter must be (String|
|
2154
|
+
rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE::Type|WIN32OLE::Method)");
|
2219
2155
|
}
|
2220
2156
|
hwnd = ole_show_help(helpfile, helpcontext);
|
2221
2157
|
if(hwnd == 0) {
|
@@ -2227,7 +2163,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self)
|
|
2227
2163
|
|
2228
2164
|
/*
|
2229
2165
|
* call-seq:
|
2230
|
-
*
|
2166
|
+
* codepage
|
2231
2167
|
*
|
2232
2168
|
* Returns current codepage.
|
2233
2169
|
* WIN32OLE.codepage # => WIN32OLE::CP_ACP
|
@@ -2258,7 +2194,7 @@ code_page_installed(UINT cp)
|
|
2258
2194
|
|
2259
2195
|
/*
|
2260
2196
|
* call-seq:
|
2261
|
-
*
|
2197
|
+
* codepage = CP
|
2262
2198
|
*
|
2263
2199
|
* Sets current codepage.
|
2264
2200
|
* The WIN32OLE.codepage is initialized according to
|
@@ -2282,7 +2218,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp)
|
|
2282
2218
|
|
2283
2219
|
/*
|
2284
2220
|
* call-seq:
|
2285
|
-
*
|
2221
|
+
* locale -> locale id.
|
2286
2222
|
*
|
2287
2223
|
* Returns current locale id (lcid). The default locale is
|
2288
2224
|
* WIN32OLE::LOCALE_SYSTEM_DEFAULT.
|
@@ -2316,12 +2252,12 @@ lcid_installed(LCID lcid)
|
|
2316
2252
|
|
2317
2253
|
/*
|
2318
2254
|
* call-seq:
|
2319
|
-
*
|
2255
|
+
* locale = lcid
|
2320
2256
|
*
|
2321
2257
|
* Sets current locale id (lcid).
|
2322
2258
|
*
|
2323
2259
|
* WIN32OLE.locale = 1033 # set locale English(U.S)
|
2324
|
-
* obj =
|
2260
|
+
* obj = WIN32OLE::Variant.new("$100,000", WIN32OLE::VARIANT::VT_CY)
|
2325
2261
|
*
|
2326
2262
|
*/
|
2327
2263
|
static VALUE
|
@@ -2345,7 +2281,7 @@ fole_s_set_locale(VALUE self, VALUE vlcid)
|
|
2345
2281
|
|
2346
2282
|
/*
|
2347
2283
|
* call-seq:
|
2348
|
-
*
|
2284
|
+
* create_guid
|
2349
2285
|
*
|
2350
2286
|
* Creates GUID.
|
2351
2287
|
* WIN32OLE.create_guid # => {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8}
|
@@ -2393,9 +2329,9 @@ fole_s_ole_uninitialize(VALUE self)
|
|
2393
2329
|
/*
|
2394
2330
|
* Document-class: WIN32OLE
|
2395
2331
|
*
|
2396
|
-
*
|
2332
|
+
* +WIN32OLE+ objects represent OLE Automation object in Ruby.
|
2397
2333
|
*
|
2398
|
-
* By using WIN32OLE
|
2334
|
+
* By using +WIN32OLE+, you can access OLE server like VBScript.
|
2399
2335
|
*
|
2400
2336
|
* Here is sample script.
|
2401
2337
|
*
|
@@ -2419,18 +2355,18 @@ fole_s_ole_uninitialize(VALUE self)
|
|
2419
2355
|
* excel.ActiveWorkbook.Close(0);
|
2420
2356
|
* excel.Quit();
|
2421
2357
|
*
|
2422
|
-
* Unfortunately,
|
2358
|
+
* Unfortunately, +WIN32OLE+ doesn't support the argument passed by
|
2423
2359
|
* reference directly.
|
2424
|
-
* Instead,
|
2360
|
+
* Instead, +WIN32OLE+ provides WIN32OLE::ARGV or WIN32OLE::Variant object.
|
2425
2361
|
* If you want to get the result value of argument passed by reference,
|
2426
|
-
* you can use WIN32OLE::ARGV or
|
2362
|
+
* you can use WIN32OLE::ARGV or WIN32OLE::Variant.
|
2427
2363
|
*
|
2428
2364
|
* oleobj.method(arg1, arg2, refargv3)
|
2429
2365
|
* puts WIN32OLE::ARGV[2] # the value of refargv3 after called oleobj.method
|
2430
2366
|
*
|
2431
2367
|
* or
|
2432
2368
|
*
|
2433
|
-
* refargv3 =
|
2369
|
+
* refargv3 = WIN32OLE::Variant.new(XXX,
|
2434
2370
|
* WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_XXX)
|
2435
2371
|
* oleobj.method(arg1, arg2, refargv3)
|
2436
2372
|
* p refargv3.value # the value of refargv3 after called oleobj.method.
|
@@ -2439,7 +2375,7 @@ fole_s_ole_uninitialize(VALUE self)
|
|
2439
2375
|
|
2440
2376
|
/*
|
2441
2377
|
* call-seq:
|
2442
|
-
*
|
2378
|
+
* new(server, [host]) -> WIN32OLE object
|
2443
2379
|
* WIN32OLE.new(server, license: 'key') -> WIN32OLE object
|
2444
2380
|
*
|
2445
2381
|
* Returns a new WIN32OLE object(OLE Automation object).
|
@@ -2826,7 +2762,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|
2826
2762
|
|
2827
2763
|
/*
|
2828
2764
|
* call-seq:
|
2829
|
-
*
|
2765
|
+
* invoke(method, [arg1,...]) => return value of method.
|
2830
2766
|
*
|
2831
2767
|
* Runs OLE method.
|
2832
2768
|
* The first argument specifies the method name of OLE Automation object.
|
@@ -3038,7 +2974,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
|
|
3038
2974
|
|
3039
2975
|
/*
|
3040
2976
|
* call-seq:
|
3041
|
-
*
|
2977
|
+
* _invoke(dispid, args, types)
|
3042
2978
|
*
|
3043
2979
|
* Runs the early binding method.
|
3044
2980
|
* The 1st argument specifies dispatch ID,
|
@@ -3056,7 +2992,7 @@ fole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types)
|
|
3056
2992
|
|
3057
2993
|
/*
|
3058
2994
|
* call-seq:
|
3059
|
-
*
|
2995
|
+
* _getproperty(dispid, args, types)
|
3060
2996
|
*
|
3061
2997
|
* Runs the early binding method to get property.
|
3062
2998
|
* The 1st argument specifies dispatch ID,
|
@@ -3074,7 +3010,7 @@ fole_getproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types)
|
|
3074
3010
|
|
3075
3011
|
/*
|
3076
3012
|
* call-seq:
|
3077
|
-
*
|
3013
|
+
* _setproperty(dispid, args, types)
|
3078
3014
|
*
|
3079
3015
|
* Runs the early binding method to set property.
|
3080
3016
|
* The 1st argument specifies dispatch ID,
|
@@ -3120,7 +3056,7 @@ fole_setproperty_with_bracket(int argc, VALUE *argv, VALUE self)
|
|
3120
3056
|
|
3121
3057
|
/*
|
3122
3058
|
* call-seq:
|
3123
|
-
*
|
3059
|
+
* setproperty('property', [arg1, arg2,...] val)
|
3124
3060
|
*
|
3125
3061
|
* Sets property of OLE object.
|
3126
3062
|
* When you want to set property with argument, you can use this method.
|
@@ -3226,7 +3162,7 @@ ole_propertyput(VALUE self, VALUE property, VALUE value)
|
|
3226
3162
|
|
3227
3163
|
/*
|
3228
3164
|
* call-seq:
|
3229
|
-
*
|
3165
|
+
* ole_free
|
3230
3166
|
*
|
3231
3167
|
* invokes Release method of Dispatch interface of WIN32OLE object.
|
3232
3168
|
* Usually, you do not need to call this method because Release method
|
@@ -3269,7 +3205,7 @@ ole_ienum_free(VALUE pEnumV)
|
|
3269
3205
|
|
3270
3206
|
/*
|
3271
3207
|
* call-seq:
|
3272
|
-
*
|
3208
|
+
* each {|i|...}
|
3273
3209
|
*
|
3274
3210
|
* Iterates over each item of OLE collection which has IEnumVARIANT interface.
|
3275
3211
|
*
|
@@ -3340,7 +3276,7 @@ fole_each(VALUE self)
|
|
3340
3276
|
|
3341
3277
|
/*
|
3342
3278
|
* call-seq:
|
3343
|
-
*
|
3279
|
+
* method_missing(id [,arg1, arg2, ...])
|
3344
3280
|
*
|
3345
3281
|
* Calls WIN32OLE#invoke method.
|
3346
3282
|
*/
|
@@ -3438,9 +3374,9 @@ ole_methods(VALUE self, int mask)
|
|
3438
3374
|
|
3439
3375
|
/*
|
3440
3376
|
* call-seq:
|
3441
|
-
*
|
3377
|
+
* ole_methods
|
3442
3378
|
*
|
3443
|
-
* Returns the array of
|
3379
|
+
* Returns the array of WIN32OLE::Method object.
|
3444
3380
|
* The element is OLE method of WIN32OLE object.
|
3445
3381
|
*
|
3446
3382
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3455,9 +3391,9 @@ fole_methods(VALUE self)
|
|
3455
3391
|
|
3456
3392
|
/*
|
3457
3393
|
* call-seq:
|
3458
|
-
*
|
3394
|
+
* ole_get_methods
|
3459
3395
|
*
|
3460
|
-
* Returns the array of
|
3396
|
+
* Returns the array of WIN32OLE::Method object .
|
3461
3397
|
* The element of the array is property (gettable) of WIN32OLE object.
|
3462
3398
|
*
|
3463
3399
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3471,9 +3407,9 @@ fole_get_methods(VALUE self)
|
|
3471
3407
|
|
3472
3408
|
/*
|
3473
3409
|
* call-seq:
|
3474
|
-
*
|
3410
|
+
* ole_put_methods
|
3475
3411
|
*
|
3476
|
-
* Returns the array of
|
3412
|
+
* Returns the array of WIN32OLE::Method object .
|
3477
3413
|
* The element of the array is property (settable) of WIN32OLE object.
|
3478
3414
|
*
|
3479
3415
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3487,9 +3423,9 @@ fole_put_methods(VALUE self)
|
|
3487
3423
|
|
3488
3424
|
/*
|
3489
3425
|
* call-seq:
|
3490
|
-
*
|
3426
|
+
* ole_func_methods
|
3491
3427
|
*
|
3492
|
-
* Returns the array of
|
3428
|
+
* Returns the array of WIN32OLE::Method object .
|
3493
3429
|
* The element of the array is property (settable) of WIN32OLE object.
|
3494
3430
|
*
|
3495
3431
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3504,9 +3440,9 @@ fole_func_methods(VALUE self)
|
|
3504
3440
|
|
3505
3441
|
/*
|
3506
3442
|
* call-seq:
|
3507
|
-
*
|
3443
|
+
* ole_type
|
3508
3444
|
*
|
3509
|
-
* Returns
|
3445
|
+
* Returns WIN32OLE::Type object.
|
3510
3446
|
*
|
3511
3447
|
* excel = WIN32OLE.new('Excel.Application')
|
3512
3448
|
* tobj = excel.ole_type
|
@@ -3529,16 +3465,16 @@ fole_type(VALUE self)
|
|
3529
3465
|
type = ole_type_from_itypeinfo(pTypeInfo);
|
3530
3466
|
OLE_RELEASE(pTypeInfo);
|
3531
3467
|
if (type == Qnil) {
|
3532
|
-
rb_raise(rb_eRuntimeError, "failed to create
|
3468
|
+
rb_raise(rb_eRuntimeError, "failed to create WIN32OLE::Type obj from ITypeInfo");
|
3533
3469
|
}
|
3534
3470
|
return type;
|
3535
3471
|
}
|
3536
3472
|
|
3537
3473
|
/*
|
3538
3474
|
* call-seq:
|
3539
|
-
*
|
3475
|
+
* ole_typelib -> The WIN32OLE_TYPELIB object
|
3540
3476
|
*
|
3541
|
-
* Returns the
|
3477
|
+
* Returns the WIN32OLE::TypeLib object. The object represents the
|
3542
3478
|
* type library which contains the WIN32OLE object.
|
3543
3479
|
*
|
3544
3480
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3570,7 +3506,7 @@ fole_typelib(VALUE self)
|
|
3570
3506
|
|
3571
3507
|
/*
|
3572
3508
|
* call-seq:
|
3573
|
-
*
|
3509
|
+
* ole_query_interface(iid) -> WIN32OLE object
|
3574
3510
|
*
|
3575
3511
|
* Returns WIN32OLE object for a specific dispatch or dual
|
3576
3512
|
* interface specified by iid.
|
@@ -3616,7 +3552,7 @@ fole_query_interface(VALUE self, VALUE str_iid)
|
|
3616
3552
|
|
3617
3553
|
/*
|
3618
3554
|
* call-seq:
|
3619
|
-
*
|
3555
|
+
* ole_respond_to?(method) -> true or false
|
3620
3556
|
*
|
3621
3557
|
* Returns true when OLE object has OLE method, otherwise returns false.
|
3622
3558
|
*
|
@@ -3825,9 +3761,9 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
|
|
3825
3761
|
|
3826
3762
|
/*
|
3827
3763
|
* call-seq:
|
3828
|
-
*
|
3764
|
+
* ole_method_help(method)
|
3829
3765
|
*
|
3830
|
-
* Returns
|
3766
|
+
* Returns WIN32OLE::Method object corresponding with method
|
3831
3767
|
* specified by 1st argument.
|
3832
3768
|
*
|
3833
3769
|
* excel = WIN32OLE.new('Excel.Application')
|
@@ -3859,7 +3795,7 @@ fole_method_help(VALUE self, VALUE cmdname)
|
|
3859
3795
|
|
3860
3796
|
/*
|
3861
3797
|
* call-seq:
|
3862
|
-
*
|
3798
|
+
* ole_activex_initialize() -> Qnil
|
3863
3799
|
*
|
3864
3800
|
* Initialize WIN32OLE object(ActiveX Control) by calling
|
3865
3801
|
* IPersistMemory::InitNew.
|
@@ -4073,7 +4009,7 @@ Init_win32ole(void)
|
|
4073
4009
|
* p c # => 0
|
4074
4010
|
* p WIN32OLE::ARGV # => [10, 20, 30]
|
4075
4011
|
*
|
4076
|
-
* You can use
|
4012
|
+
* You can use WIN32OLE::Variant object to retrieve the value of reference
|
4077
4013
|
* arguments instead of referring WIN32OLE::ARGV.
|
4078
4014
|
*
|
4079
4015
|
*/
|
@@ -67,7 +67,7 @@ void
|
|
67
67
|
Init_win32ole_error(void)
|
68
68
|
{
|
69
69
|
/*
|
70
|
-
* Document-class:
|
70
|
+
* Document-class: WIN32OLE::RuntimeError
|
71
71
|
*
|
72
72
|
* Raised when OLE processing failed.
|
73
73
|
*
|
@@ -77,11 +77,20 @@ Init_win32ole_error(void)
|
|
77
77
|
*
|
78
78
|
* raises the exception:
|
79
79
|
*
|
80
|
-
*
|
80
|
+
* WIN32OLE::RuntimeError: unknown OLE server: `NonExistProgID'
|
81
81
|
* HRESULT error code:0x800401f3
|
82
82
|
* Invalid class string
|
83
83
|
*
|
84
84
|
*/
|
85
|
-
eWIN32OLERuntimeError =
|
86
|
-
|
85
|
+
eWIN32OLERuntimeError = rb_define_class_under(cWIN32OLE, "RuntimeError", rb_eRuntimeError);
|
86
|
+
/* Alias of WIN32OLE::RuntimeError, for the backward compatibility */
|
87
|
+
rb_define_const(rb_cObject, "WIN32OLERuntimeError", eWIN32OLERuntimeError);
|
88
|
+
/*
|
89
|
+
* Document-class: WIN32OLE::QueryInterfaceError
|
90
|
+
*
|
91
|
+
* Raised when OLE query failed.
|
92
|
+
*/
|
93
|
+
eWIN32OLEQueryInterfaceError = rb_define_class_under(cWIN32OLE, "QueryInterfaceError", eWIN32OLERuntimeError);
|
94
|
+
/* Alias of WIN32OLE::QueryInterfaceError, for the backward compatibility */
|
95
|
+
rb_define_const(rb_cObject, "WIN32OLEQueryInterfaceError", eWIN32OLEQueryInterfaceError);
|
87
96
|
}
|