windows-pr 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/CHANGES +15 -0
  2. data/MANIFEST +65 -65
  3. data/README +149 -149
  4. data/Rakefile +37 -52
  5. data/doc/conversion_guide.txt +37 -37
  6. data/lib/windows/clipboard.rb +2 -0
  7. data/lib/windows/com.rb +2 -0
  8. data/lib/windows/com/accessibility.rb +12 -10
  9. data/lib/windows/com/automation.rb +149 -147
  10. data/lib/windows/com/variant.rb +24 -22
  11. data/lib/windows/console.rb +114 -112
  12. data/lib/windows/debug.rb +35 -33
  13. data/lib/windows/device_io.rb +248 -246
  14. data/lib/windows/directory.rb +2 -0
  15. data/lib/windows/error.rb +2 -0
  16. data/lib/windows/eventlog.rb +2 -0
  17. data/lib/windows/file.rb +264 -262
  18. data/lib/windows/file_mapping.rb +25 -23
  19. data/lib/windows/filesystem.rb +2 -0
  20. data/lib/windows/gdi/bitmap.rb +65 -63
  21. data/lib/windows/gdi/device_context.rb +46 -44
  22. data/lib/windows/gdi/metafile.rb +40 -38
  23. data/lib/windows/gdi/painting_drawing.rb +115 -113
  24. data/lib/windows/handle.rb +2 -0
  25. data/lib/windows/library.rb +2 -0
  26. data/lib/windows/limits.rb +34 -31
  27. data/lib/windows/mailslot.rb +2 -0
  28. data/lib/windows/memory.rb +2 -0
  29. data/lib/windows/msvcrt/buffer.rb +75 -73
  30. data/lib/windows/msvcrt/directory.rb +31 -29
  31. data/lib/windows/msvcrt/file.rb +47 -45
  32. data/lib/windows/msvcrt/io.rb +62 -60
  33. data/lib/windows/msvcrt/string.rb +2 -0
  34. data/lib/windows/msvcrt/time.rb +169 -167
  35. data/lib/windows/national.rb +580 -578
  36. data/lib/windows/network/management.rb +525 -523
  37. data/lib/windows/network/snmp.rb +92 -90
  38. data/lib/windows/network/winsock.rb +128 -126
  39. data/lib/windows/nio.rb +2 -0
  40. data/lib/windows/ntfs/winternl.rb +96 -82
  41. data/lib/windows/path.rb +143 -141
  42. data/lib/windows/pipe.rb +42 -40
  43. data/lib/windows/process.rb +2 -0
  44. data/lib/windows/registry.rb +171 -126
  45. data/lib/windows/security.rb +479 -477
  46. data/lib/windows/security/authentication.rb +32 -30
  47. data/lib/windows/service.rb +142 -140
  48. data/lib/windows/shell.rb +171 -169
  49. data/lib/windows/socket.rb +86 -0
  50. data/lib/windows/sound.rb +39 -37
  51. data/lib/windows/synchronize.rb +133 -131
  52. data/lib/windows/system_info.rb +4 -2
  53. data/lib/windows/thread.rb +2 -0
  54. data/lib/windows/time.rb +48 -46
  55. data/lib/windows/tool_helper.rb +36 -34
  56. data/lib/windows/unicode.rb +2 -0
  57. data/lib/windows/volume.rb +61 -59
  58. data/lib/windows/window.rb +81 -79
  59. data/lib/windows/window/classes.rb +59 -57
  60. data/lib/windows/window/dialog.rb +91 -89
  61. data/lib/windows/window/menu.rb +102 -100
  62. data/lib/windows/window/message.rb +297 -295
  63. data/lib/windows/window/properties.rb +20 -18
  64. data/lib/windows/window/timer.rb +19 -17
  65. data/lib/windows/wsa.rb +102 -0
  66. data/test/tc_clipboard.rb +41 -41
  67. data/test/tc_com.rb +32 -32
  68. data/test/tc_com_automation.rb +15 -15
  69. data/test/tc_console.rb +108 -108
  70. data/test/tc_debug.rb +48 -48
  71. data/test/tc_device_io.rb +29 -29
  72. data/test/tc_directory.rb +25 -25
  73. data/test/tc_error.rb +38 -50
  74. data/test/tc_eventlog.rb +58 -58
  75. data/test/tc_file.rb +67 -67
  76. data/test/tc_file_mapping.rb +38 -38
  77. data/test/tc_filesystem.rb +27 -27
  78. data/test/tc_gdi_bitmap.rb +25 -25
  79. data/test/tc_gdi_metafile.rb +23 -23
  80. data/test/tc_handle.rb +36 -36
  81. data/test/tc_library.rb +37 -37
  82. data/test/tc_limits.rb +34 -34
  83. data/test/tc_mailslot.rb +22 -22
  84. data/test/tc_memory.rb +44 -44
  85. data/test/tc_msvcrt_buffer.rb +59 -68
  86. data/test/tc_msvcrt_directory.rb +96 -98
  87. data/test/tc_msvcrt_file.rb +80 -80
  88. data/test/tc_msvcrt_io.rb +48 -48
  89. data/test/tc_msvcrt_string.rb +94 -93
  90. data/test/tc_msvcrt_time.rb +19 -29
  91. data/test/tc_national.rb +38 -38
  92. data/test/tc_network_management.rb +32 -32
  93. data/test/tc_network_snmp.rb +31 -31
  94. data/test/tc_network_winsock.rb +34 -34
  95. data/test/tc_nio.rb +32 -32
  96. data/test/tc_ntfs_winternl.rb +33 -18
  97. data/test/tc_path.rb +90 -90
  98. data/test/tc_pipe.rb +53 -53
  99. data/test/tc_process.rb +24 -24
  100. data/test/tc_registry.rb +29 -29
  101. data/test/tc_security.rb +104 -104
  102. data/test/tc_security_authentication.rb +34 -34
  103. data/test/tc_service.rb +57 -57
  104. data/test/tc_shell.rb +34 -34
  105. data/test/tc_socket.rb +20 -0
  106. data/test/tc_sound.rb +37 -37
  107. data/test/tc_synchronize.rb +75 -75
  108. data/test/tc_system_info.rb +33 -43
  109. data/test/tc_thread.rb +29 -29
  110. data/test/tc_time.rb +32 -32
  111. data/test/tc_tool_helper.rb +29 -29
  112. data/test/tc_unicode.rb +62 -62
  113. data/test/tc_volume.rb +47 -47
  114. data/test/tc_window.rb +45 -45
  115. data/test/tc_window_classes.rb +33 -33
  116. data/test/tc_window_dialog.rb +33 -33
  117. data/test/tc_window_menu.rb +29 -29
  118. data/test/tc_window_message.rb +33 -33
  119. data/test/tc_window_properties.rb +29 -29
  120. data/test/tc_window_timer.rb +29 -29
  121. data/test/tc_wsa.rb +19 -0
  122. data/windows-pr.gemspec +1 -1
  123. metadata +13 -7
@@ -7,6 +7,8 @@ module Windows
7
7
  API.auto_method = true
8
8
  API.auto_unicode = true
9
9
 
10
+ private
11
+
10
12
  SYNCHRONIZE = 0x00100000
11
13
  THREAD_ALL_ACCESS = 0x1F03FF
12
14
  THREAD_DIRECT_IMPERSONATION = 0x0200
data/lib/windows/time.rb CHANGED
@@ -1,46 +1,48 @@
1
- require 'windows/api'
2
-
3
- # In general you will want to use this module with Windows::National because
4
- # it contains the various LOCALE and TIME constants.
5
-
6
- module Windows
7
- module Time
8
- API.auto_namespace = 'Windows::Time'
9
- API.auto_constant = true
10
- API.auto_method = true
11
- API.auto_unicode = true
12
-
13
- TIME_ZONE_ID_UNKNOWN = 0
14
- TIME_ZONE_ID_STANDARD = 1
15
- TIME_ZONE_ID_DAYLIGHT = 2
16
-
17
- API.new('CompareFileTime', 'PP', 'L')
18
- API.new('DosDateTimeToFileTime', 'IIP', 'B')
19
- API.new('FileTimeToDosDateTime', 'PPP', 'B')
20
- API.new('FileTimeToLocalFileTime', 'PP', 'B')
21
- API.new('FileTimeToSystemTime', 'PP', 'B')
22
- API.new('GetFileTime', 'LPPP', 'B')
23
- API.new('GetLocalTime', 'P')
24
- API.new('GetSystemTime', 'P')
25
- API.new('GetSystemTimeAdjustment', 'PPP', 'B')
26
- API.new('GetSystemTimeAsFileTime', 'P')
27
- API.new('GetTickCount')
28
- API.new('GetTimeFormat', 'ILPPPI', 'I')
29
- API.new('GetTimeZoneInformation', 'P', 'L')
30
- API.new('LocalFileTimeToFileTime', 'PP', 'B')
31
- API.new('SetFileTime', 'LPPP', 'B')
32
- API.new('SetLocalTime', 'P', 'B')
33
- API.new('SetSystemTime', 'P', 'B')
34
- API.new('SetTimeZoneInformation', 'P', 'B')
35
- API.new('SetSystemTimeAdjustment', 'LI', 'B')
36
- API.new('SystemTimeToFileTime', 'PP', 'B')
37
- API.new('SystemTimeToTzSpecificLocalTime', 'PPP', 'B')
38
-
39
- begin
40
- API.new('GetSystemTimes', 'PPP', 'B')
41
- API.new('TzSpecificLocalTimeToSystemTime', 'PPP', 'B')
42
- rescue Win32::API::LoadLibraryError
43
- # Windows XP or later
44
- end
45
- end
46
- end
1
+ require 'windows/api'
2
+
3
+ # In general you will want to use this module with Windows::National because
4
+ # it contains the various LOCALE and TIME constants.
5
+
6
+ module Windows
7
+ module Time
8
+ API.auto_namespace = 'Windows::Time'
9
+ API.auto_constant = true
10
+ API.auto_method = true
11
+ API.auto_unicode = true
12
+
13
+ private
14
+
15
+ TIME_ZONE_ID_UNKNOWN = 0
16
+ TIME_ZONE_ID_STANDARD = 1
17
+ TIME_ZONE_ID_DAYLIGHT = 2
18
+
19
+ API.new('CompareFileTime', 'PP', 'L')
20
+ API.new('DosDateTimeToFileTime', 'IIP', 'B')
21
+ API.new('FileTimeToDosDateTime', 'PPP', 'B')
22
+ API.new('FileTimeToLocalFileTime', 'PP', 'B')
23
+ API.new('FileTimeToSystemTime', 'PP', 'B')
24
+ API.new('GetFileTime', 'LPPP', 'B')
25
+ API.new('GetLocalTime', 'P')
26
+ API.new('GetSystemTime', 'P')
27
+ API.new('GetSystemTimeAdjustment', 'PPP', 'B')
28
+ API.new('GetSystemTimeAsFileTime', 'P')
29
+ API.new('GetTickCount')
30
+ API.new('GetTimeFormat', 'ILPPPI', 'I')
31
+ API.new('GetTimeZoneInformation', 'P', 'L')
32
+ API.new('LocalFileTimeToFileTime', 'PP', 'B')
33
+ API.new('SetFileTime', 'LPPP', 'B')
34
+ API.new('SetLocalTime', 'P', 'B')
35
+ API.new('SetSystemTime', 'P', 'B')
36
+ API.new('SetTimeZoneInformation', 'P', 'B')
37
+ API.new('SetSystemTimeAdjustment', 'LI', 'B')
38
+ API.new('SystemTimeToFileTime', 'PP', 'B')
39
+ API.new('SystemTimeToTzSpecificLocalTime', 'PPP', 'B')
40
+
41
+ begin
42
+ API.new('GetSystemTimes', 'PPP', 'B')
43
+ API.new('TzSpecificLocalTimeToSystemTime', 'PPP', 'B')
44
+ rescue Win32::API::LoadLibraryError
45
+ # Windows XP or later
46
+ end
47
+ end
48
+ end
@@ -1,34 +1,36 @@
1
- require 'windows/api'
2
-
3
- # Functions and constants from tlhelp32.h
4
-
5
- module Windows
6
- module ToolHelper
7
- API.auto_namespace = 'Windows::ToolHelper'
8
- API.auto_constant = true
9
- API.auto_method = true
10
- API.auto_unicode = true
11
-
12
- TH32CS_SNAPHEAPLIST = 0x00000001
13
- TH32CS_SNAPPROCESS = 0x00000002
14
- TH32CS_SNAPTHREAD = 0x00000004
15
- TH32CS_SNAPMODULE = 0x00000008
16
- TH32CS_SNAPMODULE32 = 0x00000010
17
- TH32CS_INHERIT = 0x80000000
18
- TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE |
19
- TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
20
-
21
- API.new('CreateToolhelp32Snapshot', 'LL', 'L')
22
- API.new('Heap32First', 'PLL', 'B')
23
- API.new('Heap32ListFirst', 'LP', 'B')
24
- API.new('Heap32ListNext', 'LP', 'B')
25
- API.new('Heap32Next', 'P', 'B')
26
- API.new('Module32First', 'LP', 'B')
27
- API.new('Module32Next', 'LP', 'B')
28
- API.new('Process32First', 'LP', 'B')
29
- API.new('Process32Next', 'LP', 'B')
30
- API.new('Thread32First', 'LP', 'B')
31
- API.new('Thread32Next', 'LP', 'B')
32
- API.new('Toolhelp32ReadProcessMemory', 'LLPLL', 'B')
33
- end
34
- end
1
+ require 'windows/api'
2
+
3
+ # Functions and constants from tlhelp32.h
4
+
5
+ module Windows
6
+ module ToolHelper
7
+ API.auto_namespace = 'Windows::ToolHelper'
8
+ API.auto_constant = true
9
+ API.auto_method = true
10
+ API.auto_unicode = true
11
+
12
+ private
13
+
14
+ TH32CS_SNAPHEAPLIST = 0x00000001
15
+ TH32CS_SNAPPROCESS = 0x00000002
16
+ TH32CS_SNAPTHREAD = 0x00000004
17
+ TH32CS_SNAPMODULE = 0x00000008
18
+ TH32CS_SNAPMODULE32 = 0x00000010
19
+ TH32CS_INHERIT = 0x80000000
20
+ TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE |
21
+ TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
22
+
23
+ API.new('CreateToolhelp32Snapshot', 'LL', 'L')
24
+ API.new('Heap32First', 'PLL', 'B')
25
+ API.new('Heap32ListFirst', 'LP', 'B')
26
+ API.new('Heap32ListNext', 'LP', 'B')
27
+ API.new('Heap32Next', 'P', 'B')
28
+ API.new('Module32First', 'LP', 'B')
29
+ API.new('Module32Next', 'LP', 'B')
30
+ API.new('Process32First', 'LP', 'B')
31
+ API.new('Process32Next', 'LP', 'B')
32
+ API.new('Thread32First', 'LP', 'B')
33
+ API.new('Thread32Next', 'LP', 'B')
34
+ API.new('Toolhelp32ReadProcessMemory', 'LLPLL', 'B')
35
+ end
36
+ end
@@ -7,6 +7,8 @@ module Windows
7
7
  module Unicode
8
8
  include Windows::MSVCRT::String
9
9
  include Windows::Error
10
+
11
+ private
10
12
 
11
13
  API.auto_namespace = 'Windows::Unicode'
12
14
  API.auto_constant = true
@@ -1,59 +1,61 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Volume
5
- API.auto_namespace = 'Windows::Volume'
6
- API.auto_constant = true
7
- API.auto_method = true
8
- API.auto_unicode = true
9
-
10
- DRIVE_UNKNOWN = 0
11
- DRIVE_NO_ROOT_DIR = 1
12
- DRIVE_REMOVABLE = 2
13
- DRIVE_FIXED = 3
14
- DRIVE_REMOTE = 4
15
- DRIVE_CDROM = 5
16
- DRIVE_RAMDISK = 6
17
-
18
- API.new('DefineDosDevice', 'LSS', 'B')
19
- API.new('DeleteVolumeMountPoint', 'S', 'B')
20
- API.new('FindFirstVolume', 'PL', 'L')
21
- API.new('FindFirstVolumeMountPoint', 'SPL', 'L')
22
- API.new('FindNextVolume', 'LPL', 'B')
23
- API.new('FindNextVolumeMountPoint', 'LPL', 'B')
24
- API.new('FindVolumeClose', 'L', 'B')
25
- API.new('FindVolumeMountPointClose', 'L', 'B')
26
- API.new('GetDriveType', 'S', 'I')
27
- API.new('GetLogicalDrives', 'V', 'L')
28
- API.new('GetLogicalDriveStrings', 'LP', 'L')
29
- API.new('GetVolumeInformation', 'SPLPPPPL', 'B')
30
- API.new('GetVolumeNameForVolumeMountPoint', 'SPL', 'B')
31
- API.new('GetVolumePathName', 'PPL', 'B')
32
- API.new('QueryDosDevice', 'SPL', 'L')
33
- API.new('SetVolumeLabel', 'SS', 'B')
34
- API.new('SetVolumeMountPoint', 'SS', 'B')
35
-
36
- begin
37
- API.new('GetVolumePathNamesForVolumeName', 'SPLL', 'B')
38
- rescue Win32::API::LoadLibraryError
39
- # Windows XP or later
40
- end
41
-
42
- begin
43
- API.new('GetVolumeInformationByHandleW', 'LPLPPPPL', 'B')
44
- rescue Win32::API::LoadLibraryError
45
- # Windows Vista or later
46
- end
47
-
48
- # Returns the volume type for +vol+ or the volume of the current
49
- # process if no volume is specified.
50
- #
51
- # Returns nil if the function fails for any reason.
52
- #
53
- def get_volume_type(vol = nil)
54
- buf = 0.chr * 256
55
- bool = GetVolumeInformation(vol, nil, nil, nil, nil, nil, buf, buf.size)
56
- bool ? buf.strip : nil
57
- end
58
- end
59
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Volume
5
+ API.auto_namespace = 'Windows::Volume'
6
+ API.auto_constant = true
7
+ API.auto_method = true
8
+ API.auto_unicode = true
9
+
10
+ private
11
+
12
+ DRIVE_UNKNOWN = 0
13
+ DRIVE_NO_ROOT_DIR = 1
14
+ DRIVE_REMOVABLE = 2
15
+ DRIVE_FIXED = 3
16
+ DRIVE_REMOTE = 4
17
+ DRIVE_CDROM = 5
18
+ DRIVE_RAMDISK = 6
19
+
20
+ API.new('DefineDosDevice', 'LSS', 'B')
21
+ API.new('DeleteVolumeMountPoint', 'S', 'B')
22
+ API.new('FindFirstVolume', 'PL', 'L')
23
+ API.new('FindFirstVolumeMountPoint', 'SPL', 'L')
24
+ API.new('FindNextVolume', 'LPL', 'B')
25
+ API.new('FindNextVolumeMountPoint', 'LPL', 'B')
26
+ API.new('FindVolumeClose', 'L', 'B')
27
+ API.new('FindVolumeMountPointClose', 'L', 'B')
28
+ API.new('GetDriveType', 'S', 'I')
29
+ API.new('GetLogicalDrives', 'V', 'L')
30
+ API.new('GetLogicalDriveStrings', 'LP', 'L')
31
+ API.new('GetVolumeInformation', 'SPLPPPPL', 'B')
32
+ API.new('GetVolumeNameForVolumeMountPoint', 'SPL', 'B')
33
+ API.new('GetVolumePathName', 'PPL', 'B')
34
+ API.new('QueryDosDevice', 'SPL', 'L')
35
+ API.new('SetVolumeLabel', 'SS', 'B')
36
+ API.new('SetVolumeMountPoint', 'SS', 'B')
37
+
38
+ begin
39
+ API.new('GetVolumePathNamesForVolumeName', 'SPLL', 'B')
40
+ rescue Win32::API::LoadLibraryError
41
+ # Windows XP or later
42
+ end
43
+
44
+ begin
45
+ API.new('GetVolumeInformationByHandleW', 'LPLPPPPL', 'B')
46
+ rescue Win32::API::LoadLibraryError
47
+ # Windows Vista or later
48
+ end
49
+
50
+ # Returns the volume type for +vol+ or the volume of the current
51
+ # process if no volume is specified.
52
+ #
53
+ # Returns nil if the function fails for any reason.
54
+ #
55
+ def get_volume_type(vol = nil)
56
+ buf = 0.chr * 256
57
+ bool = GetVolumeInformation(vol, nil, nil, nil, nil, nil, buf, buf.size)
58
+ bool ? buf.strip : nil
59
+ end
60
+ end
61
+ end
@@ -1,79 +1,81 @@
1
- require 'windows/api'
2
-
3
- # See WinUser.h
4
-
5
- module Windows
6
- module Window
7
- API.auto_namespace = 'Windows::Window'
8
- API.auto_constant = true
9
- API.auto_method = true
10
- API.auto_unicode = false
11
-
12
- # ShowWindow() constants
13
- SW_HIDE = 0
14
- SW_SHOWNORMAL = 1
15
- SW_NORMAL = 1
16
- SW_SHOWMINIMIZED = 2
17
- SW_SHOWMAXIMIZED = 3
18
- SW_MAXIMIZE = 3
19
- SW_SHOWNOACTIVATE = 4
20
- SW_SHOW = 5
21
- SW_MINIMIZE = 6
22
- SW_SHOWMINNOACTIVE = 7
23
- SW_SHOWNA = 8
24
- SW_RESTORE = 9
25
- SW_SHOWDEFAULT = 10
26
- SW_FORCEMINIMIZE = 11
27
- SW_MAX = 11
28
-
29
- API.new('CloseWindow', 'L', 'B', 'user32')
30
- API.new('CreateWindowEx', 'LPPLIIIILLLL', 'L', 'user32')
31
- API.new('EnumWindows', 'KP', 'L', 'user32')
32
- API.new('FindWindow', 'PP', 'L', 'user32')
33
- API.new('FindWindowEx', 'LLPP', 'L', 'user32')
34
- API.new('GetAltTabInfo', 'LIPPI', 'B', 'user32')
35
- API.new('GetAncestor', 'LI', 'L', 'user32')
36
- API.new('GetClientRect', 'LP', 'B', 'user32')
37
- API.new('GetDesktopWindow', 'V', 'L', 'user32')
38
- API.new('GetForegroundWindow', 'V', 'L', 'user32')
39
- API.new('GetGUIThreadInfo', 'LP', 'B', 'user32')
40
- API.new('GetLastActivePopup', 'L', 'L', 'user32')
41
- API.new('GetParent', 'L', 'L', 'user32')
42
- API.new('GetProcessDefaultLayout', 'P', 'B', 'user32')
43
- API.new('GetShellWindow', 'V', 'L', 'user32')
44
- API.new('GetTitleBarInfo', 'LP', 'B', 'user32')
45
- API.new('GetTopWindow', 'L', 'L', 'user32')
46
- API.new('GetWindow', 'LI', 'L', 'user32')
47
- API.new('GetWindowInfo', 'LP', 'B', 'user32')
48
- API.new('GetWindowModuleFileName', 'LLI', 'I', 'user32')
49
- API.new('GetWindowPlacement', 'LP', 'B', 'user32')
50
- API.new('GetWindowRect', 'LP', 'B', 'user32')
51
- API.new('GetWindowText', 'LPI', 'I', 'user32')
52
- API.new('GetWindowTextLength', 'L', 'I', 'user32')
53
- API.new('GetWindowThreadProcessId', 'LP', 'L', 'user32')
54
-
55
- begin
56
- API.new('GetLayeredWindowAttributes', 'LPBL', 'B', 'user32')
57
- rescue Win32::API::LoadLibraryError
58
- # Windows XP or later
59
- end
60
-
61
- # Recent versions of user32.dll turn CreateWindow into a macro for the CreateWindowEx function.
62
- #
63
- begin
64
- API.new('CreateWindow', 'PPLIIIILLLL', 'L', 'user32')
65
- rescue Win32::API::LoadLibraryError
66
- def CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
67
- CreateWindowEx(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
68
- end
69
-
70
- def CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
71
- CreateWindowExA(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
72
- end
73
-
74
- def CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
75
- CreateWindowExW(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
76
- end
77
- end
78
- end
79
- end
1
+ require 'windows/api'
2
+
3
+ # See WinUser.h
4
+
5
+ module Windows
6
+ module Window
7
+ API.auto_namespace = 'Windows::Window'
8
+ API.auto_constant = true
9
+ API.auto_method = true
10
+ API.auto_unicode = false
11
+
12
+ private
13
+
14
+ # ShowWindow() constants
15
+ SW_HIDE = 0
16
+ SW_SHOWNORMAL = 1
17
+ SW_NORMAL = 1
18
+ SW_SHOWMINIMIZED = 2
19
+ SW_SHOWMAXIMIZED = 3
20
+ SW_MAXIMIZE = 3
21
+ SW_SHOWNOACTIVATE = 4
22
+ SW_SHOW = 5
23
+ SW_MINIMIZE = 6
24
+ SW_SHOWMINNOACTIVE = 7
25
+ SW_SHOWNA = 8
26
+ SW_RESTORE = 9
27
+ SW_SHOWDEFAULT = 10
28
+ SW_FORCEMINIMIZE = 11
29
+ SW_MAX = 11
30
+
31
+ API.new('CloseWindow', 'L', 'B', 'user32')
32
+ API.new('CreateWindowEx', 'LPPLIIIILLLL', 'L', 'user32')
33
+ API.new('EnumWindows', 'KP', 'L', 'user32')
34
+ API.new('FindWindow', 'PP', 'L', 'user32')
35
+ API.new('FindWindowEx', 'LLPP', 'L', 'user32')
36
+ API.new('GetAltTabInfo', 'LIPPI', 'B', 'user32')
37
+ API.new('GetAncestor', 'LI', 'L', 'user32')
38
+ API.new('GetClientRect', 'LP', 'B', 'user32')
39
+ API.new('GetDesktopWindow', 'V', 'L', 'user32')
40
+ API.new('GetForegroundWindow', 'V', 'L', 'user32')
41
+ API.new('GetGUIThreadInfo', 'LP', 'B', 'user32')
42
+ API.new('GetLastActivePopup', 'L', 'L', 'user32')
43
+ API.new('GetParent', 'L', 'L', 'user32')
44
+ API.new('GetProcessDefaultLayout', 'P', 'B', 'user32')
45
+ API.new('GetShellWindow', 'V', 'L', 'user32')
46
+ API.new('GetTitleBarInfo', 'LP', 'B', 'user32')
47
+ API.new('GetTopWindow', 'L', 'L', 'user32')
48
+ API.new('GetWindow', 'LI', 'L', 'user32')
49
+ API.new('GetWindowInfo', 'LP', 'B', 'user32')
50
+ API.new('GetWindowModuleFileName', 'LLI', 'I', 'user32')
51
+ API.new('GetWindowPlacement', 'LP', 'B', 'user32')
52
+ API.new('GetWindowRect', 'LP', 'B', 'user32')
53
+ API.new('GetWindowText', 'LPI', 'I', 'user32')
54
+ API.new('GetWindowTextLength', 'L', 'I', 'user32')
55
+ API.new('GetWindowThreadProcessId', 'LP', 'L', 'user32')
56
+
57
+ begin
58
+ API.new('GetLayeredWindowAttributes', 'LPBL', 'B', 'user32')
59
+ rescue Win32::API::LoadLibraryError
60
+ # Windows XP or later
61
+ end
62
+
63
+ # Recent versions of user32.dll turn CreateWindow into a macro for the CreateWindowEx function.
64
+ #
65
+ begin
66
+ API.new('CreateWindow', 'PPLIIIILLLL', 'L', 'user32')
67
+ rescue Win32::API::LoadLibraryError
68
+ def CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
69
+ CreateWindowEx(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
70
+ end
71
+
72
+ def CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
73
+ CreateWindowExA(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
74
+ end
75
+
76
+ def CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
77
+ CreateWindowExW(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
78
+ end
79
+ end
80
+ end
81
+ end