rdp-win32screenshot 0.0.6.3 → 0.0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.0.7 2010-08-18
2
+ * Supports now fully JRuby, 1.9.1 and 1.9.2 MRI!
3
+
1
4
  = 0.0.6 2010-08-07
2
5
  * Trying to bring window to the foreground more aggressively (Roger Pack)
3
6
  * Added utility class Win32::Screenshot.Util with some helper methods not related directly with taking of the screenshots:
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 0.0.6.3
1
+ 0.0.7.1
2
+
@@ -42,7 +42,8 @@ module Win32
42
42
  [:long], :bool
43
43
  attach_function :set_active_window, :SetActiveWindow,
44
44
  [:long], :long
45
-
45
+ attach_function :GetWindowThreadProcessId, [:ulong, :pointer],
46
+ :uint
46
47
 
47
48
  # gdi32.dll
48
49
  attach_function :create_compatible_dc, :CreateCompatibleDC,
@@ -62,7 +63,9 @@ module Win32
62
63
  attach_function :release_dc, :ReleaseDC,
63
64
  [:long, :long], :int
64
65
 
65
-
66
+
67
+
68
+
66
69
  EnumWindowCallback = FFI::Function.new(:bool, [ :long, :pointer ], { :convention => :stdcall }) do |hwnd, param|
67
70
  searched_window = WindowStruct.new param
68
71
  title = Util.window_title(hwnd)
@@ -119,6 +122,12 @@ module Win32
119
122
  attach_thread_input(foreground_thread, other_thread, false) unless other_thread == foreground_thread
120
123
  end
121
124
  end
125
+
126
+ def get_process_id_from_hwnd hwnd
127
+ out = FFI::MemoryPointer.new(:uint)
128
+ GetWindowThreadProcessId(hwnd, out)
129
+ out.get_uint32(0) # read_uint
130
+ end
122
131
 
123
132
  def capture_all(hwnd, &proc)
124
133
  width, height = Util.dimensions_for(hwnd)
data/lib/win32/util.rb CHANGED
@@ -33,6 +33,10 @@ module Win32
33
33
  _, _, width, height = rect.unpack('L4')
34
34
  return width, height
35
35
  end
36
+
37
+ def window_process_id(hwnd)
38
+ BitmapMaker.get_process_id_from_hwnd(hwnd)
39
+ end
36
40
 
37
41
  end
38
42
  end
@@ -174,8 +174,10 @@ describe Win32::Screenshot do
174
174
  end
175
175
 
176
176
  after :all do
177
- Process.kill 9, @notepad
178
- Process.kill 9, @iexplore rescue nil # allow for a pre-existing IE to have been used.
179
- Process.kill 9, @calc
177
+ for name in [/calculator/i, /Notepad/, /Internet Explorer/] do
178
+ # kill them in a jruby friendly way
179
+ pid = Win32::Screenshot::Util.window_process_id(Win32::Screenshot::Util.window_hwnd(name))
180
+ system("taskkill /PID #{pid}")
181
+ end
180
182
  end
181
183
  end
@@ -4,6 +4,8 @@ describe Win32::Screenshot::Util do
4
4
  include SpecHelper
5
5
 
6
6
  before :all do
7
+ # should not have any running calculators yet...
8
+ proc {Win32::Screenshot::Util.window_hwnd("Calculator") }.should raise_exception("window with title 'Calculator' was not found!")
7
9
  @calc = IO.popen("calc").pid
8
10
  wait_for_calculator_to_open
9
11
  @calc_hwnd = Win32::Screenshot::Util.window_hwnd("Calculator")
@@ -33,6 +35,9 @@ describe Win32::Screenshot::Util do
33
35
  end
34
36
 
35
37
  after :all do
36
- Process.kill 9, @calc
38
+ # test our hwnd -> pid method
39
+ calc_pid = Win32::Screenshot::Util.window_process_id(@calc_hwnd)
40
+ system("taskkill /PID #{calc_pid}")
41
+ proc {Win32::Screenshot::Util.window_hwnd("Calculator") }.should raise_exception("window with title 'Calculator' was not found!")
37
42
  end
38
43
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{win32screenshot}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jarmo Pertman", "Aslak Helles\303\270y"]
12
- s.date = %q{2010-08-07}
12
+ s.date = %q{2010-08-18}
13
13
  s.description = %q{Capture Screenshots on Windows with Ruby}
14
14
  s.email = ["jarmo.p@gmail.com", "aslak.hellesoy@gmail.com"]
15
15
  s.extra_rdoc_files = [
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.homepage = %q{http://github.com/jarmo/win32screenshot}
37
37
  s.rdoc_options = ["--main", "README.rdoc"]
38
38
  s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.3.6}
39
+ s.rubygems_version = %q{1.3.7}
40
40
  s.summary = %q{Capture Screenshots on Windows with Ruby}
41
41
  s.test_files = [
42
42
  "spec/spec_helper.rb",
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
48
48
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
49
  s.specification_version = 3
50
50
 
51
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
52
  s.add_runtime_dependency(%q<ffi>, [">= 0"])
53
53
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
54
54
  s.add_development_dependency(%q<os>, [">= 0"])
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- - 3
10
- version: 0.0.6.3
8
+ - 7
9
+ - 1
10
+ version: 0.0.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jarmo Pertman
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-16 00:00:00 -06:00
19
+ date: 2010-08-19 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency