win-user32-ruby 0.1.5 → 0.1.7

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.
data/README CHANGED
@@ -1,5 +1,9 @@
1
1
  = WinUser32Ruby
2
2
 
3
+ ==0.1.7
4
+ * Added set_window_text
5
+ * Added unit test
6
+
3
7
  ==0.1.5
4
8
  * Added get_client_rect
5
9
  * Added client_to_screen
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ require 'spec/rake/spectask'
13
13
 
14
14
  spec = Gem::Specification.new do |s|
15
15
  s.name = 'win-user32-ruby'
16
- s.version = '0.1.5'
16
+ s.version = '0.1.7'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Ruby wrapper for the user32.dll on Windows.'
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
  s.author = 'Jerry Fernholz'
22
22
  s.email = 'jerry.fernholz@gmail.com'
23
23
  # s.executables = ['your_executable_here']
24
- s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
24
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,test,spec}/**/*")
25
25
  s.require_path = "lib"
26
26
  s.bindir = "bin"
27
27
  s.add_dependency('win32-api', '>= 1.4.2')
@@ -97,6 +97,17 @@ module WinUser32Ruby
97
97
  length == 0 ? '' : buffer[0..length - 1]
98
98
  end
99
99
 
100
+ # Wrapper for +WM_SETTEXT+.
101
+ # _text_:: desired window text
102
+ # *Return*::
103
+ def set_window_text(text)
104
+
105
+ text = text + "\0"
106
+
107
+ ret = send_message @handle, WM_SETTEXT, 0, text
108
+
109
+ ret != 0
110
+ end
100
111
 
101
112
  # Wrapper for +GetWindowRect+.
102
113
  # *Return*:: [left, top, right, bottom]
@@ -0,0 +1,20 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
+
6
+ require 'test/unit'
7
+
8
+ require 'win-user32-ruby'
9
+ include WinUser32Ruby
10
+
11
+ require 'win-gdi32-ruby'
12
+ include WinGdi32Ruby
13
+
14
+ class WinUser32Test < Test::Unit::TestCase
15
+ def test_set_window_text
16
+ wnd = Window.get_foreground_window
17
+
18
+ raise 'Failed to set text' unless wnd.set_window_text("hello")
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win-user32-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Fernholz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-23 00:00:00 -07:00
12
+ date: 2009-08-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -39,6 +39,7 @@ files:
39
39
  - lib/user32/system_const.rb
40
40
  - lib/user32/user32_system.rb
41
41
  - lib/win-user32-ruby.rb
42
+ - test/win_user32_ruby_test.rb
42
43
  has_rdoc: true
43
44
  homepage:
44
45
  post_install_message: