windows-pr 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +444 -438
  3. data/MANIFEST +68 -65
  4. data/README +154 -153
  5. data/Rakefile +42 -37
  6. data/doc/conversion_guide.txt +37 -37
  7. data/lib/windows/clipboard.rb +61 -61
  8. data/lib/windows/com.rb +192 -192
  9. data/lib/windows/com/accessibility.rb +16 -16
  10. data/lib/windows/com/automation.rb +149 -149
  11. data/lib/windows/com/variant.rb +24 -24
  12. data/lib/windows/console.rb +114 -114
  13. data/lib/windows/debug.rb +35 -35
  14. data/lib/windows/device_io.rb +248 -248
  15. data/lib/windows/directory.rb +27 -27
  16. data/lib/windows/error.rb +504 -498
  17. data/lib/windows/eventlog.rb +80 -80
  18. data/lib/windows/file.rb +264 -264
  19. data/lib/windows/file_mapping.rb +25 -25
  20. data/lib/windows/filesystem.rb +15 -15
  21. data/lib/windows/gdi/bitmap.rb +65 -65
  22. data/lib/windows/gdi/device_context.rb +46 -46
  23. data/lib/windows/gdi/metafile.rb +40 -40
  24. data/lib/windows/gdi/painting_drawing.rb +115 -115
  25. data/lib/windows/handle.rb +23 -23
  26. data/lib/windows/library.rb +44 -44
  27. data/lib/windows/limits.rb +34 -34
  28. data/lib/windows/mailslot.rb +24 -24
  29. data/lib/windows/memory.rb +128 -128
  30. data/lib/windows/msvcrt/buffer.rb +75 -75
  31. data/lib/windows/msvcrt/directory.rb +31 -31
  32. data/lib/windows/msvcrt/file.rb +47 -47
  33. data/lib/windows/msvcrt/io.rb +73 -73
  34. data/lib/windows/msvcrt/string.rb +182 -182
  35. data/lib/windows/msvcrt/time.rb +169 -169
  36. data/lib/windows/national.rb +580 -580
  37. data/lib/windows/network/management.rb +525 -525
  38. data/lib/windows/network/snmp.rb +92 -92
  39. data/lib/windows/network/winsock.rb +128 -128
  40. data/lib/windows/nio.rb +50 -50
  41. data/lib/windows/ntfs/winternl.rb +117 -117
  42. data/lib/windows/path.rb +143 -143
  43. data/lib/windows/pipe.rb +42 -42
  44. data/lib/windows/process.rb +176 -176
  45. data/lib/windows/registry.rb +171 -171
  46. data/lib/windows/security.rb +479 -479
  47. data/lib/windows/security/authentication.rb +32 -32
  48. data/lib/windows/security/sspi.rb +153 -0
  49. data/lib/windows/service.rb +142 -142
  50. data/lib/windows/shell.rb +171 -171
  51. data/lib/windows/socket.rb +86 -86
  52. data/lib/windows/sound.rb +39 -39
  53. data/lib/windows/synchronize.rb +133 -133
  54. data/lib/windows/system_info.rb +229 -229
  55. data/lib/windows/thread.rb +64 -64
  56. data/lib/windows/time.rb +48 -48
  57. data/lib/windows/tool_helper.rb +36 -36
  58. data/lib/windows/unicode.rb +155 -155
  59. data/lib/windows/volume.rb +61 -61
  60. data/lib/windows/window.rb +81 -81
  61. data/lib/windows/window/classes.rb +59 -59
  62. data/lib/windows/window/dialog.rb +91 -91
  63. data/lib/windows/window/menu.rb +102 -102
  64. data/lib/windows/window/message.rb +297 -297
  65. data/lib/windows/window/properties.rb +20 -20
  66. data/lib/windows/window/timer.rb +19 -19
  67. data/lib/windows/wsa.rb +102 -102
  68. data/test/tc_clipboard.rb +41 -41
  69. data/test/tc_com.rb +32 -32
  70. data/test/tc_com_automation.rb +15 -15
  71. data/test/tc_console.rb +108 -108
  72. data/test/tc_debug.rb +48 -48
  73. data/test/tc_device_io.rb +29 -29
  74. data/test/tc_directory.rb +25 -25
  75. data/test/tc_error.rb +38 -38
  76. data/test/tc_eventlog.rb +58 -58
  77. data/test/tc_file.rb +67 -67
  78. data/test/tc_file_mapping.rb +38 -38
  79. data/test/tc_filesystem.rb +27 -27
  80. data/test/tc_gdi_bitmap.rb +25 -25
  81. data/test/tc_gdi_metafile.rb +23 -23
  82. data/test/tc_handle.rb +36 -36
  83. data/test/tc_library.rb +37 -37
  84. data/test/tc_limits.rb +34 -34
  85. data/test/tc_mailslot.rb +22 -22
  86. data/test/tc_memory.rb +44 -44
  87. data/test/tc_msvcrt_buffer.rb +63 -63
  88. data/test/tc_msvcrt_directory.rb +96 -96
  89. data/test/tc_msvcrt_file.rb +80 -80
  90. data/test/tc_msvcrt_io.rb +48 -48
  91. data/test/tc_msvcrt_string.rb +94 -94
  92. data/test/tc_msvcrt_time.rb +19 -19
  93. data/test/tc_national.rb +38 -38
  94. data/test/tc_network_management.rb +32 -32
  95. data/test/tc_network_snmp.rb +31 -31
  96. data/test/tc_network_winsock.rb +34 -34
  97. data/test/tc_nio.rb +32 -32
  98. data/test/tc_ntfs_winternl.rb +48 -48
  99. data/test/tc_path.rb +90 -90
  100. data/test/tc_pipe.rb +53 -53
  101. data/test/tc_process.rb +24 -24
  102. data/test/tc_registry.rb +29 -29
  103. data/test/tc_security.rb +104 -104
  104. data/test/tc_security_authentication.rb +34 -34
  105. data/test/tc_security_sspi.rb +23 -0
  106. data/test/tc_service.rb +57 -57
  107. data/test/tc_shell.rb +34 -34
  108. data/test/tc_socket.rb +20 -20
  109. data/test/tc_sound.rb +37 -37
  110. data/test/tc_synchronize.rb +75 -75
  111. data/test/tc_system_info.rb +33 -33
  112. data/test/tc_thread.rb +29 -29
  113. data/test/tc_time.rb +32 -32
  114. data/test/tc_tool_helper.rb +29 -29
  115. data/test/tc_unicode.rb +83 -83
  116. data/test/tc_volume.rb +47 -47
  117. data/test/tc_window.rb +45 -45
  118. data/test/tc_window_classes.rb +33 -33
  119. data/test/tc_window_dialog.rb +33 -33
  120. data/test/tc_window_menu.rb +29 -29
  121. data/test/tc_window_message.rb +33 -33
  122. data/test/tc_window_properties.rb +29 -29
  123. data/test/tc_window_timer.rb +29 -29
  124. data/test/tc_wsa.rb +19 -19
  125. data/windows-pr.gemspec +33 -34
  126. metadata +31 -32
@@ -1,61 +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
- 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
+ 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,81 +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
- 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
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
@@ -1,59 +1,59 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Window
5
- module Classes
6
- API.auto_namespace = 'Windows::Window::Classes'
7
- API.auto_constant = true
8
- API.auto_method = true
9
- API.auto_unicode = true
10
-
11
- private
12
-
13
- # Class Field Offsets
14
-
15
- GCL_MENUNAME = -8
16
- GCL_HBRBACKGROUND = -10
17
- GCL_HCURSOR = -12
18
- GCL_HICON = -14
19
- GCL_HMODULE = -16
20
- GCL_CBWNDEXTRA = -18
21
- GCL_CBCLSEXTRA = -20
22
- GCL_WNDPROC = -24
23
- GCL_STYLE = -26
24
- GCW_ATOM = -32
25
-
26
- # Window Field Offsets
27
-
28
- GWL_WNDPROC = -4
29
- GWL_HINSTANCE = -6
30
- GWL_HWNDPARENT = -8
31
- GWL_STYLE = -16
32
- GWL_EXSTYLE = -20
33
- GWL_USERDATA = -21
34
- GWL_ID = -12
35
-
36
- API.new('GetClassInfo', 'LPP', 'B', 'user32')
37
- API.new('GetClassInfoEx', 'LPP', 'B', 'user32')
38
- API.new('GetClassLong', 'LI', 'L', 'user32')
39
- API.new('GetClassName', 'LPI', 'I', 'user32')
40
- API.new('GetClassWord', 'LI', 'L', 'user32')
41
- API.new('GetWindowLong', 'LI', 'L', 'user32')
42
- API.new('RegisterClass', 'P', 'L', 'user32')
43
- API.new('RegisterClassEx', 'P', 'L', 'user32')
44
- API.new('SetClassLong', 'LIL', 'L', 'user32')
45
- API.new('SetClassWord', 'LIL', 'L', 'user32')
46
- API.new('SetWindowLong', 'LIL', 'L', 'user32')
47
- API.new('UnregisterClass', 'PL', 'B', 'user32')
48
-
49
- # In 32-bit Windows, these methods are aliases
50
- begin
51
- API.new('GetWindowLongPtr', 'LI', 'L', 'user32')
52
- API.new('SetWindowLongPtr', 'LIP', 'L', 'user32')
53
- rescue Win32::API::LoadLibraryError
54
- alias :GetWindowLongPtr :GetWindowLong
55
- alias :SetWindowLongPtr :SetWindowLong
56
- end
57
- end
58
- end
59
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Window
5
+ module Classes
6
+ API.auto_namespace = 'Windows::Window::Classes'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = true
10
+
11
+ private
12
+
13
+ # Class Field Offsets
14
+
15
+ GCL_MENUNAME = -8
16
+ GCL_HBRBACKGROUND = -10
17
+ GCL_HCURSOR = -12
18
+ GCL_HICON = -14
19
+ GCL_HMODULE = -16
20
+ GCL_CBWNDEXTRA = -18
21
+ GCL_CBCLSEXTRA = -20
22
+ GCL_WNDPROC = -24
23
+ GCL_STYLE = -26
24
+ GCW_ATOM = -32
25
+
26
+ # Window Field Offsets
27
+
28
+ GWL_WNDPROC = -4
29
+ GWL_HINSTANCE = -6
30
+ GWL_HWNDPARENT = -8
31
+ GWL_STYLE = -16
32
+ GWL_EXSTYLE = -20
33
+ GWL_USERDATA = -21
34
+ GWL_ID = -12
35
+
36
+ API.new('GetClassInfo', 'LPP', 'B', 'user32')
37
+ API.new('GetClassInfoEx', 'LPP', 'B', 'user32')
38
+ API.new('GetClassLong', 'LI', 'L', 'user32')
39
+ API.new('GetClassName', 'LPI', 'I', 'user32')
40
+ API.new('GetClassWord', 'LI', 'L', 'user32')
41
+ API.new('GetWindowLong', 'LI', 'L', 'user32')
42
+ API.new('RegisterClass', 'P', 'L', 'user32')
43
+ API.new('RegisterClassEx', 'P', 'L', 'user32')
44
+ API.new('SetClassLong', 'LIL', 'L', 'user32')
45
+ API.new('SetClassWord', 'LIL', 'L', 'user32')
46
+ API.new('SetWindowLong', 'LIL', 'L', 'user32')
47
+ API.new('UnregisterClass', 'PL', 'B', 'user32')
48
+
49
+ # In 32-bit Windows, these methods are aliases
50
+ begin
51
+ API.new('GetWindowLongPtr', 'LI', 'L', 'user32')
52
+ API.new('SetWindowLongPtr', 'LIP', 'L', 'user32')
53
+ rescue Win32::API::LoadLibraryError
54
+ alias :GetWindowLongPtr :GetWindowLong
55
+ alias :SetWindowLongPtr :SetWindowLong
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,91 +1,91 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Window
5
- module Dialog
6
- API.auto_namespace = 'Windows::Window::Dialog'
7
- API.auto_constant = true
8
- API.auto_method = true
9
- API.auto_unicode = true
10
-
11
- private
12
-
13
- MB_OK = 0x00000000
14
- MB_OKCANCEL = 0x00000001
15
- MB_ABORTRETRYIGNORE = 0x00000002
16
- MB_YESNOCANCEL = 0x00000003
17
- MB_YESNO = 0x00000004
18
- MB_RETRYCANCEL = 0x00000005
19
- MB_CANCELTRYCONTINUE = 0x00000006
20
- MB_ICONHAND = 0x00000010
21
- MB_ICONQUESTION = 0x00000020
22
- MB_ICONEXCLAMATION = 0x00000030
23
- MB_ICONASTERISK = 0x00000040
24
- MB_USERICON = 0x00000080
25
- MB_ICONWARNING = MB_ICONEXCLAMATION
26
- MB_ICONERROR = MB_ICONHAND
27
- MB_ICONINFORMATION = MB_ICONASTERISK
28
- MB_ICONSTOP = MB_ICONHAND
29
- MB_DEFBUTTON1 = 0x00000000
30
- MB_DEFBUTTON2 = 0x00000100
31
- MB_DEFBUTTON3 = 0x00000200
32
- MB_DEFBUTTON4 = 0x00000300
33
- MB_APPLMODAL = 0x00000000
34
- MB_SYSTEMMODAL = 0x00001000
35
- MB_TASKMODAL = 0x00002000
36
- MB_HELP = 0x00004000
37
- MB_NOFOCUS = 0x00008000
38
- MB_SETFOREGROUND = 0x00010000
39
- MB_DEFAULT_DESKTOP_ONLY = 0x00020000
40
- MB_TOPMOST = 0x00040000
41
- MB_RIGHT = 0x00080000
42
- MB_RTLREADING = 0x00100000
43
- MB_SERVICE_NOTIFICATION = 0x00200000 # Assume Win2k or later
44
- MB_SERVICE_NOTIFICATION_NT3X = 0x00040000
45
- MB_TYPEMASK = 0x0000000F
46
- MB_ICONMASK = 0x000000F0
47
- MB_DEFMASK = 0x00000F00
48
- MB_MODEMASK = 0x00003000
49
- MB_MISCMASK = 0x0000C000
50
-
51
- API.new('CreateDialogIndirectParam', 'LPLKL', 'L', 'user32')
52
- API.new('CreateDialogParam', 'LPLKL', 'L', 'user32')
53
- API.new('DialogBoxIndirectParam', 'LPLKL', 'P', 'user32')
54
- API.new('DialogBoxParam', 'LPLKL', 'P', 'user32')
55
- API.new('EndDialog', 'LP', 'B', 'user32')
56
- API.new('GetDialogBaseUnits', 'V', 'L', 'user32')
57
- API.new('GetDlgCtrlID', 'L', 'I', 'user32')
58
- API.new('GetDlgItem', 'LI', 'L', 'user32')
59
- API.new('GetDlgItemInt', 'LIPI', 'I', 'user32')
60
- API.new('GetDlgItemText', 'LIPI', 'I', 'user32')
61
- API.new('GetNextDlgGroupItem', 'LLI', 'L', 'user32')
62
- API.new('GetNextDlgTabItem', 'LLI', 'L', 'user32')
63
- API.new('IsDialogMessage', 'LP', 'B', 'user32')
64
- API.new('MapDialogRect', 'LP', 'B', 'user32')
65
- API.new('MessageBox', 'LPPI', 'I', 'user32')
66
- API.new('MessageBoxEx', 'LPPII', 'I', 'user32')
67
- API.new('MessageBoxIndirect', 'P', 'I', 'user32')
68
- API.new('SendDlgItemMessage', 'LIILL', 'L', 'user32')
69
- API.new('SetDlgItemInt', 'LIII', 'L', 'user32')
70
- API.new('SetDlgItemText', 'LIP', 'B', 'user32')
71
-
72
- # Macros from WinUser.h
73
-
74
- def CreateDialog(hInstance, lpName, hParent, lpDialogFunc)
75
- CreateDialogParam.call(hInstance, lpName, hParent, lpDialogFunc, 0)
76
- end
77
-
78
- def CreateDialogIndirect(hInst, lpTemp, hPar, lpDialFunc)
79
- CreateDialogIndirectParam.call(hInst, lpTemp, hPar, lpDialFunc, 0)
80
- end
81
-
82
- def DialogBox(hInstance, lpTemp, hParent, lpDialogFunc)
83
- DialogBoxParam.call(hInstance, lpTemp, hParent, lpDialogFunc, 0)
84
- end
85
-
86
- def DialogBoxIndirect(hInst, lpTemp, hParent, lpDialogFunc)
87
- DialogBoxParamIndirect.call(hInst, lpTemp, hParent, lpDialogFunc, 0)
88
- end
89
- end
90
- end
91
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Window
5
+ module Dialog
6
+ API.auto_namespace = 'Windows::Window::Dialog'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = true
10
+
11
+ private
12
+
13
+ MB_OK = 0x00000000
14
+ MB_OKCANCEL = 0x00000001
15
+ MB_ABORTRETRYIGNORE = 0x00000002
16
+ MB_YESNOCANCEL = 0x00000003
17
+ MB_YESNO = 0x00000004
18
+ MB_RETRYCANCEL = 0x00000005
19
+ MB_CANCELTRYCONTINUE = 0x00000006
20
+ MB_ICONHAND = 0x00000010
21
+ MB_ICONQUESTION = 0x00000020
22
+ MB_ICONEXCLAMATION = 0x00000030
23
+ MB_ICONASTERISK = 0x00000040
24
+ MB_USERICON = 0x00000080
25
+ MB_ICONWARNING = MB_ICONEXCLAMATION
26
+ MB_ICONERROR = MB_ICONHAND
27
+ MB_ICONINFORMATION = MB_ICONASTERISK
28
+ MB_ICONSTOP = MB_ICONHAND
29
+ MB_DEFBUTTON1 = 0x00000000
30
+ MB_DEFBUTTON2 = 0x00000100
31
+ MB_DEFBUTTON3 = 0x00000200
32
+ MB_DEFBUTTON4 = 0x00000300
33
+ MB_APPLMODAL = 0x00000000
34
+ MB_SYSTEMMODAL = 0x00001000
35
+ MB_TASKMODAL = 0x00002000
36
+ MB_HELP = 0x00004000
37
+ MB_NOFOCUS = 0x00008000
38
+ MB_SETFOREGROUND = 0x00010000
39
+ MB_DEFAULT_DESKTOP_ONLY = 0x00020000
40
+ MB_TOPMOST = 0x00040000
41
+ MB_RIGHT = 0x00080000
42
+ MB_RTLREADING = 0x00100000
43
+ MB_SERVICE_NOTIFICATION = 0x00200000 # Assume Win2k or later
44
+ MB_SERVICE_NOTIFICATION_NT3X = 0x00040000
45
+ MB_TYPEMASK = 0x0000000F
46
+ MB_ICONMASK = 0x000000F0
47
+ MB_DEFMASK = 0x00000F00
48
+ MB_MODEMASK = 0x00003000
49
+ MB_MISCMASK = 0x0000C000
50
+
51
+ API.new('CreateDialogIndirectParam', 'LPLKL', 'L', 'user32')
52
+ API.new('CreateDialogParam', 'LPLKL', 'L', 'user32')
53
+ API.new('DialogBoxIndirectParam', 'LPLKL', 'P', 'user32')
54
+ API.new('DialogBoxParam', 'LPLKL', 'P', 'user32')
55
+ API.new('EndDialog', 'LP', 'B', 'user32')
56
+ API.new('GetDialogBaseUnits', 'V', 'L', 'user32')
57
+ API.new('GetDlgCtrlID', 'L', 'I', 'user32')
58
+ API.new('GetDlgItem', 'LI', 'L', 'user32')
59
+ API.new('GetDlgItemInt', 'LIPI', 'I', 'user32')
60
+ API.new('GetDlgItemText', 'LIPI', 'I', 'user32')
61
+ API.new('GetNextDlgGroupItem', 'LLI', 'L', 'user32')
62
+ API.new('GetNextDlgTabItem', 'LLI', 'L', 'user32')
63
+ API.new('IsDialogMessage', 'LP', 'B', 'user32')
64
+ API.new('MapDialogRect', 'LP', 'B', 'user32')
65
+ API.new('MessageBox', 'LPPI', 'I', 'user32')
66
+ API.new('MessageBoxEx', 'LPPII', 'I', 'user32')
67
+ API.new('MessageBoxIndirect', 'P', 'I', 'user32')
68
+ API.new('SendDlgItemMessage', 'LIILL', 'L', 'user32')
69
+ API.new('SetDlgItemInt', 'LIII', 'L', 'user32')
70
+ API.new('SetDlgItemText', 'LIP', 'B', 'user32')
71
+
72
+ # Macros from WinUser.h
73
+
74
+ def CreateDialog(hInstance, lpName, hParent, lpDialogFunc)
75
+ CreateDialogParam.call(hInstance, lpName, hParent, lpDialogFunc, 0)
76
+ end
77
+
78
+ def CreateDialogIndirect(hInst, lpTemp, hPar, lpDialFunc)
79
+ CreateDialogIndirectParam.call(hInst, lpTemp, hPar, lpDialFunc, 0)
80
+ end
81
+
82
+ def DialogBox(hInstance, lpTemp, hParent, lpDialogFunc)
83
+ DialogBoxParam.call(hInstance, lpTemp, hParent, lpDialogFunc, 0)
84
+ end
85
+
86
+ def DialogBoxIndirect(hInst, lpTemp, hParent, lpDialogFunc)
87
+ DialogBoxParamIndirect.call(hInst, lpTemp, hParent, lpDialogFunc, 0)
88
+ end
89
+ end
90
+ end
91
+ end