robust_excel_ole 1.38 → 1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/robust_excel_ole/excel.rb +30 -15
- data/lib/robust_excel_ole/version.rb +1 -1
- data/spec/data/workbook.xlsx +0 -0
- data/spec/excel_spec.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b55888236ecd8ff3750b2b961c15ba52b67d3525566dc58ff6f6144c4a3d4ac
|
4
|
+
data.tar.gz: c1585bfc357054685c44cea38aa597bbb6b3e5d9fc5ed97978a81857bf83679a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fc661d429fea1ad21bf62b453e899090e854467b09846b230b86ca2b4f8fb448ed0afe13a1e86dde0c91c8da9fc72a80eb16429588ce6fdb5a1469695f9a16c
|
7
|
+
data.tar.gz: 0e88736e07de3ff534c10efc4a635b2dffdbaf1f9c962106e4f1773d7422ee516052bbcea21eb2bf3f88b3038d2dbd0409d3734b0f09f20c98700f27e1599736
|
@@ -7,6 +7,7 @@ def ka
|
|
7
7
|
Excel.kill_all
|
8
8
|
end
|
9
9
|
|
10
|
+
=begin
|
10
11
|
module User32
|
11
12
|
# Extend this module to an importer
|
12
13
|
extend Fiddle::Importer
|
@@ -57,6 +58,7 @@ module Oleacc
|
|
57
58
|
#extern 'HRESULT AccessibleObjectFromWindow(HWND, DWORD, void*, ppvObject)'
|
58
59
|
#extern 'HRESULT AccessibleObjectFromWindow(HWND, DWORD, struct GUID*, ppvObject)'
|
59
60
|
end
|
61
|
+
=end
|
60
62
|
|
61
63
|
module RobustExcelOle
|
62
64
|
|
@@ -347,12 +349,12 @@ module RobustExcelOle
|
|
347
349
|
GC.start
|
348
350
|
sleep 0.1
|
349
351
|
if finishing_living_excel
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
352
|
+
# if hwnd
|
353
|
+
# pid_puffer = ' ' * 32
|
354
|
+
# User32::GetWindowThreadProcessId(hwnd, pid_puffer)
|
355
|
+
# pid = pid_puffer.unpack('L')[0]
|
356
|
+
# Process.kill('KILL', pid) rescue nil
|
357
|
+
# end
|
356
358
|
@@hwnd2excel.delete(hwnd)
|
357
359
|
weak_xl.ole_free if weak_xl.weakref_alive?
|
358
360
|
end
|
@@ -414,6 +416,7 @@ module RobustExcelOle
|
|
414
416
|
# returns running Excel instances
|
415
417
|
# !!! This is work in progress
|
416
418
|
# the approach is currently restricted to visible Excel instances with at least one workbook
|
419
|
+
=begin
|
417
420
|
def self.running_excel_instances
|
418
421
|
win32ole_excel_instances = []
|
419
422
|
hwnd = 0
|
@@ -478,6 +481,8 @@ module RobustExcelOle
|
|
478
481
|
alias known_excel_instances known_running_instances # :deprecated: #
|
479
482
|
end
|
480
483
|
|
484
|
+
=end
|
485
|
+
|
481
486
|
private
|
482
487
|
|
483
488
|
# returns a Win32OLE object that represents a Excel instance to which Excel connects
|
@@ -552,19 +557,29 @@ module RobustExcelOle
|
|
552
557
|
self.Hwnd == other_excel.Hwnd if other_excel.is_a?(Excel) && alive? && other_excel.alive?
|
553
558
|
end
|
554
559
|
|
560
|
+
# def alive?
|
561
|
+
#msg = 0x2008
|
562
|
+
#wparam = 0
|
563
|
+
#lparam = 0
|
564
|
+
#flags = 0x0000 # 0x0002
|
565
|
+
#duration = 5000
|
566
|
+
#lpdw_result_puffer = ' ' * 32
|
567
|
+
#status = User32::SendMessageTimeoutA(hwnd, msg, wparam, lparam, flags, duration, lpdw_result_puffer)
|
568
|
+
#result = lpdw_result_puffer.unpack('L')[0]
|
569
|
+
#status != 0
|
570
|
+
# end
|
571
|
+
|
555
572
|
# returns true, if the Excel instances responds to VBA methods, false otherwise
|
556
573
|
def alive?
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
lpdw_result_puffer = ' ' * 32
|
563
|
-
status = User32::SendMessageTimeoutA(hwnd, msg, wparam, lparam, flags, duration, lpdw_result_puffer)
|
564
|
-
result = lpdw_result_puffer.unpack('L')[0]
|
565
|
-
status != 0
|
574
|
+
@ole_excel.Name
|
575
|
+
true
|
576
|
+
rescue
|
577
|
+
# trace $!.message
|
578
|
+
false
|
566
579
|
end
|
567
580
|
|
581
|
+
|
582
|
+
|
568
583
|
# returns unsaved workbooks in known (not opened by user) Excel instances
|
569
584
|
# @private
|
570
585
|
def self.unsaved_known_workbooks
|
data/spec/data/workbook.xlsx
CHANGED
Binary file
|
data/spec/excel_spec.rb
CHANGED
@@ -1922,6 +1922,7 @@ module RobustExcelOle
|
|
1922
1922
|
|
1923
1923
|
end
|
1924
1924
|
|
1925
|
+
=begin
|
1925
1926
|
describe "known_running_instances" do
|
1926
1927
|
|
1927
1928
|
it "should return empty list" do
|
@@ -1952,7 +1953,7 @@ module RobustExcelOle
|
|
1952
1953
|
end
|
1953
1954
|
|
1954
1955
|
end
|
1955
|
-
|
1956
|
+
=end
|
1956
1957
|
context "with hwnd and hwnd2excel" do
|
1957
1958
|
|
1958
1959
|
before do
|