vrvirtualdesktop 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/LICENSE +1 -0
- data/README +37 -0
- data/TODO +3 -0
- data/bin/vrdesk.rbw +55 -0
- data/lib/VRVirtualDesktopForm.rb +267 -0
- data/lib/Win32/APIMapper.rb +62 -0
- data/lib/Win32/Base-consts.rb +891 -0
- data/lib/Win32/Base.rb +275 -0
- data/lib/Win32/Encoding.rb +68 -0
- data/lib/Win32/GetSystemMetrics.rb +107 -0
- data/lib/Win32/NetResources.rb +160 -0
- data/lib/Win32/Process.rb +468 -0
- data/lib/Win32/Registry.rb +515 -0
- data/lib/Win32/User32.rb +142 -0
- data/lib/Win32/VirtualDesktop.rb +418 -0
- data/lib/Win32/WindowManager.rb +177 -0
- data/lib/resources/desktops.ico +0 -0
- data/lib/resources/five_down.ico +0 -0
- data/lib/resources/five_up.ico +0 -0
- data/lib/resources/four_down.ico +0 -0
- data/lib/resources/four_up.ico +0 -0
- data/lib/resources/obdb.ico +0 -0
- data/lib/resources/one_down.ico +0 -0
- data/lib/resources/one_up.ico +0 -0
- data/lib/resources/six_down.ico +0 -0
- data/lib/resources/six_up.ico +0 -0
- data/lib/resources/three_down.ico +0 -0
- data/lib/resources/three_up.ico +0 -0
- data/lib/resources/two_down.ico +0 -0
- data/lib/resources/two_up.ico +0 -0
- metadata +97 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
require "Win32/User32"
|
2
|
+
require "rubygems"
|
3
|
+
require_gem "SimpleTrace", "< 0.1.0"
|
4
|
+
|
5
|
+
module Win32
|
6
|
+
|
7
|
+
class WindowManager
|
8
|
+
private
|
9
|
+
def get_task_bar_window
|
10
|
+
@shell_hook_message, rs = RegisterWindowMessage.call("SHELLHOOK")
|
11
|
+
@hwnd_tray, rs = FindWindowEx.call(NULL, NULL, "Shell_TrayWnd", nil);
|
12
|
+
@hwnd_bar, rs = FindWindowEx.call(@hwnd_tray, NULL, "ReBarWindow32", nil );
|
13
|
+
|
14
|
+
hwnd_bar1 = @hwnd_bar
|
15
|
+
hwnd_bar1 = @hwnd_tray if hwnd_bar1 == NULL
|
16
|
+
@hwnd_task_list, rs = FindWindowEx.call(hwnd_bar1, NULL, "MSTaskSwWClass", nil)
|
17
|
+
|
18
|
+
$TRACE.debug 5, sprintf("hwnd_tray = %d, hwnd_bar = %d, hwnd_task_list = %d\n",
|
19
|
+
@hwnd_tray, hwnd_bar1, @hwnd_task_list)
|
20
|
+
return @hwnd_task_list
|
21
|
+
end
|
22
|
+
|
23
|
+
public
|
24
|
+
TRUE = 1
|
25
|
+
|
26
|
+
class Window
|
27
|
+
|
28
|
+
class << self
|
29
|
+
# create is here to allow another program to
|
30
|
+
# change how virtual desktops are created (use an object
|
31
|
+
# loaded off of disk instead of a freshly created one
|
32
|
+
def create(*args)
|
33
|
+
Window.new(*args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_reader :hwnd, :style, :ex_style, :class_name, :owner
|
38
|
+
def initialize(hwnd, style, ex_style, class_name, owner, window_manager)
|
39
|
+
@hwnd ||= hwnd
|
40
|
+
@style ||= style
|
41
|
+
@ex_style ||= ex_style
|
42
|
+
@class_name ||= class_name
|
43
|
+
@owner ||= owner
|
44
|
+
@window_manager ||= window_manager
|
45
|
+
end
|
46
|
+
|
47
|
+
def hide
|
48
|
+
@window_manager.hide_window(@hwnd)
|
49
|
+
end
|
50
|
+
|
51
|
+
def show
|
52
|
+
@window_manager.show_window(@hwnd, iconic?)
|
53
|
+
end
|
54
|
+
|
55
|
+
def iconic?
|
56
|
+
@window_manager.iconic?(@hwnd)
|
57
|
+
end
|
58
|
+
|
59
|
+
def ==(other)
|
60
|
+
return false unless other.kind_of?(self.class)
|
61
|
+
return @hwnd == other.hwnd
|
62
|
+
end
|
63
|
+
|
64
|
+
def eql?(other)
|
65
|
+
self == other
|
66
|
+
end
|
67
|
+
|
68
|
+
def hash
|
69
|
+
@hwnd.hash
|
70
|
+
end
|
71
|
+
|
72
|
+
def to_s
|
73
|
+
"#{@hwnd}-#{@class_name}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize
|
78
|
+
get_task_bar_window
|
79
|
+
|
80
|
+
@buff = " " * 16
|
81
|
+
@windows = {}
|
82
|
+
|
83
|
+
@enum_windows_proc = DL.callback('ILL') do |hwnd,lparam|
|
84
|
+
@window_handles.push(hwnd)
|
85
|
+
TRUE
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def process_window_handles(window_handles, test)
|
90
|
+
window_handles.each do |hwnd|
|
91
|
+
#style, rs = GetWindowLong.call(hwnd, GWL_STYLE)
|
92
|
+
#ex_style, rs = GetWindowLong.call(hwnd, GWL_EXSTYLE)
|
93
|
+
#owner, rs = GetWindow.call(hwnd, GW_OWNER)
|
94
|
+
style = GetWindowLong_2.call(hwnd, GWL_STYLE)
|
95
|
+
ex_style = GetWindowLong_2.call(hwnd, GWL_EXSTYLE)
|
96
|
+
owner = GetWindow_2.call(hwnd, GW_OWNER)
|
97
|
+
|
98
|
+
# if the window is visible AND
|
99
|
+
# its NOT a tool window with no parent
|
100
|
+
#r,rs = GetClassName.call(hwnd, @buff, @buff.size)
|
101
|
+
#class_name = rs[1]
|
102
|
+
GetClassName_2.call(hwnd, @buff, @buff.size)
|
103
|
+
class_name = @buff.dup
|
104
|
+
if !(((ex_style & WS_EX_TOOLWINDOW) != 0) && (owner == NULL)) then
|
105
|
+
if ((style & WS_VISIBLE) != 0) || @get_not_visible_windows then
|
106
|
+
# ignore Kapsules main window
|
107
|
+
next if (/WindowsForms10/.match(class_name))
|
108
|
+
|
109
|
+
@windows[hwnd] = Window.create(hwnd, style, ex_style, class_name, owner, self)
|
110
|
+
$TRACE.debug 7, sprintf("%d, rs[1] = '%s', style = %8.8x, ex_style = %8.8x, owner = %d\n",
|
111
|
+
hwnd, class_name, style, ex_style, owner)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_all_windows(get_not_visible_windows=false,test=false)
|
118
|
+
|
119
|
+
#if !@enum_windows_proc then
|
120
|
+
#end
|
121
|
+
@buff = " " * 16
|
122
|
+
@windows = {}
|
123
|
+
@window_handles = []
|
124
|
+
@test = test
|
125
|
+
@get_not_visible_windows = get_not_visible_windows
|
126
|
+
|
127
|
+
r,rs = EnumWindows.call(@enum_windows_proc, 0)
|
128
|
+
|
129
|
+
process_window_handles(@window_handles, test) #if !test
|
130
|
+
return @windows
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_top_window(windows)
|
134
|
+
get_all_windows.each_key do |hwnd|
|
135
|
+
top_window = hwnd
|
136
|
+
sub_windows = []
|
137
|
+
#puts "#{top_window}: "
|
138
|
+
while true
|
139
|
+
hwnd, rs = GetWindow.call(hwnd, GW_HWNDPREV)
|
140
|
+
break if hwnd == NULL
|
141
|
+
#puts " #{hwnd}"
|
142
|
+
sub_windows.push(hwnd) if windows.has_key?(hwnd)
|
143
|
+
end
|
144
|
+
#puts "#{top_window}: " + sub_windows.join(",")
|
145
|
+
return top_window if sub_windows == []
|
146
|
+
end
|
147
|
+
return 0
|
148
|
+
end
|
149
|
+
|
150
|
+
def hide_window(window_handle)
|
151
|
+
$TRACE.debug 5, "@hwnd_task_list = #{@hwnd_task_list}"
|
152
|
+
$TRACE.debug 5, "@shell_hook_message = #{@shell_hook_message}"
|
153
|
+
$TRACE.debug 5, "window_handle = #{window_handle}"
|
154
|
+
|
155
|
+
SendMessage.call(@hwnd_task_list, @shell_hook_message, 2, window_handle)
|
156
|
+
# ShowWindow.call(window_handle, SW_SHOWMINNOACTIVE)
|
157
|
+
ShowWindow.call(window_handle, SW_HIDE)
|
158
|
+
end
|
159
|
+
|
160
|
+
def show_window(window_handle, is_iconic)
|
161
|
+
SendMessage.call(@hwnd_task_list, @shell_hook_message, 1, window_handle)
|
162
|
+
if is_iconic then
|
163
|
+
ShowWindow.call(window_handle, SW_SHOWMINNOACTIVE)
|
164
|
+
else
|
165
|
+
ShowWindow.call(window_handle, SW_SHOWNOACTIVATE)
|
166
|
+
end
|
167
|
+
# ShowWindow.call(window_handle, SW_SHOW)
|
168
|
+
end
|
169
|
+
|
170
|
+
def iconic?(window_handle)
|
171
|
+
r, rs = IsIconic.call(window_handle)
|
172
|
+
r == TRUE
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
end # module Win32
|
177
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.3
|
3
|
+
specification_version: 1
|
4
|
+
name: vrvirtualdesktop
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.1
|
7
|
+
date: 2006-04-24
|
8
|
+
summary: This module implements workspace manager for Windows (NT/2000/XP)
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email:
|
12
|
+
homepage:
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
-
|
22
|
+
- ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
authors: []
|
28
|
+
files:
|
29
|
+
- "./CHANGES"
|
30
|
+
- "./LICENSE"
|
31
|
+
- "./README"
|
32
|
+
- "./TODO"
|
33
|
+
- lib/VRVirtualDesktopForm.rb
|
34
|
+
- lib/Win32/APIMapper.rb
|
35
|
+
- lib/Win32/Base-consts.rb
|
36
|
+
- lib/Win32/Base.rb
|
37
|
+
- lib/Win32/Encoding.rb
|
38
|
+
- lib/Win32/GetSystemMetrics.rb
|
39
|
+
- lib/Win32/NetResources.rb
|
40
|
+
- lib/Win32/Process.rb
|
41
|
+
- lib/Win32/Registry.rb
|
42
|
+
- lib/Win32/User32.rb
|
43
|
+
- lib/Win32/VirtualDesktop.rb
|
44
|
+
- lib/Win32/WindowManager.rb
|
45
|
+
- bin/vrdesk.rbw
|
46
|
+
- lib/resources/desktops.ico
|
47
|
+
- lib/resources/five_down.ico
|
48
|
+
- lib/resources/five_up.ico
|
49
|
+
- lib/resources/four_down.ico
|
50
|
+
- lib/resources/four_up.ico
|
51
|
+
- lib/resources/obdb.ico
|
52
|
+
- lib/resources/one_down.ico
|
53
|
+
- lib/resources/one_up.ico
|
54
|
+
- lib/resources/six_down.ico
|
55
|
+
- lib/resources/six_up.ico
|
56
|
+
- lib/resources/three_down.ico
|
57
|
+
- lib/resources/three_up.ico
|
58
|
+
- lib/resources/two_down.ico
|
59
|
+
- lib/resources/two_up.ico
|
60
|
+
test_files: []
|
61
|
+
rdoc_options: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
executables:
|
64
|
+
- vrdesk.rbw
|
65
|
+
extensions: []
|
66
|
+
requirements: []
|
67
|
+
dependencies:
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: usage
|
70
|
+
version_requirement:
|
71
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
72
|
+
requirements:
|
73
|
+
-
|
74
|
+
- "<"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.1.0
|
77
|
+
version:
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: VRTools
|
80
|
+
version_requirement:
|
81
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
82
|
+
requirements:
|
83
|
+
-
|
84
|
+
- "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.1.0
|
87
|
+
version:
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: SimpleTrace
|
90
|
+
version_requirement:
|
91
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
92
|
+
requirements:
|
93
|
+
-
|
94
|
+
- "<"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.1.0
|
97
|
+
version:
|