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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2639b34c270ac16732d4de9ff06be54e2ba33cf5c1cf9d7842ed7a639044b4c
4
- data.tar.gz: 3533deb112141e2221b00479d6f4207891b7977c0ac1cf6ff37b40ade580fea1
3
+ metadata.gz: 3b55888236ecd8ff3750b2b961c15ba52b67d3525566dc58ff6f6144c4a3d4ac
4
+ data.tar.gz: c1585bfc357054685c44cea38aa597bbb6b3e5d9fc5ed97978a81857bf83679a
5
5
  SHA512:
6
- metadata.gz: 19071fbe4d293f73f02081c9cb23f706d2102a97d3a038324551e912a6b17929282e0fff738b98f30a2377bf7f2f48b9fb5eaa699a4439b989f2e174a1ff9a63
7
- data.tar.gz: 8da4acac7393db1c62b352842aa6b8944b0ecb1fc410077b62d9b0f618a82e07df69612afb0077c0fedfedb824d1962e97c90041a762e4cbadd6691534f1d3f7
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
- if hwnd
351
- pid_puffer = ' ' * 32
352
- User32::GetWindowThreadProcessId(hwnd, pid_puffer)
353
- pid = pid_puffer.unpack('L')[0]
354
- Process.kill('KILL', pid) rescue nil
355
- end
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
- msg = 0x2008
558
- wparam = 0
559
- lparam = 0
560
- flags = 0x0000 # 0x0002
561
- duration = 5000
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
@@ -1,3 +1,3 @@
1
1
  module RobustExcelOle
2
- VERSION = "1.38"
2
+ VERSION = "1.39"
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robust_excel_ole
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.38'
4
+ version: '1.39'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths