win32console 1.0.8-i386-mswin32 → 1.1.0-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Console.cpp +15 -0
  2. data/HISTORY_GEM.txt +34 -0
  3. data/README.txt +0 -1
  4. data/{lib/README_GEM.txt → README_GEM.txt} +1 -1
  5. data/Rakefile +5 -5
  6. data/lib/Console.so +0 -0
  7. data/lib/Win32/Console/ANSI.rb +283 -240
  8. data/lib/Win32/Console/api.rb +342 -0
  9. data/lib/Win32/Console/constants.rb +66 -0
  10. data/lib/Win32/Console.rb +77 -675
  11. metadata +10 -114
  12. data/doc/classes/Win32/Console/ANSI/IO.html +0 -220
  13. data/doc/classes/Win32/Console/ANSI/IO.src/M000035.html +0 -32
  14. data/doc/classes/Win32/Console/ANSI/IO.src/M000036.html +0 -205
  15. data/doc/classes/Win32/Console/ANSI/IO.src/M000037.html +0 -40
  16. data/doc/classes/Win32/Console/ANSI/IO.src/M000038.html +0 -25
  17. data/doc/classes/Win32/Console/ANSI.html +0 -103
  18. data/doc/classes/Win32/Console/API.html +0 -758
  19. data/doc/classes/Win32/Console/API.src/M000039.html +0 -27
  20. data/doc/classes/Win32/Console/API.src/M000040.html +0 -27
  21. data/doc/classes/Win32/Console/API.src/M000041.html +0 -27
  22. data/doc/classes/Win32/Console/API.src/M000042.html +0 -32
  23. data/doc/classes/Win32/Console/API.src/M000043.html +0 -32
  24. data/doc/classes/Win32/Console/API.src/M000044.html +0 -28
  25. data/doc/classes/Win32/Console/API.src/M000045.html +0 -26
  26. data/doc/classes/Win32/Console/API.src/M000046.html +0 -26
  27. data/doc/classes/Win32/Console/API.src/M000047.html +0 -27
  28. data/doc/classes/Win32/Console/API.src/M000048.html +0 -30
  29. data/doc/classes/Win32/Console/API.src/M000049.html +0 -29
  30. data/doc/classes/Win32/Console/API.src/M000050.html +0 -27
  31. data/doc/classes/Win32/Console/API.src/M000051.html +0 -28
  32. data/doc/classes/Win32/Console/API.src/M000052.html +0 -30
  33. data/doc/classes/Win32/Console/API.src/M000053.html +0 -27
  34. data/doc/classes/Win32/Console/API.src/M000054.html +0 -29
  35. data/doc/classes/Win32/Console/API.src/M000055.html +0 -29
  36. data/doc/classes/Win32/Console/API.src/M000056.html +0 -28
  37. data/doc/classes/Win32/Console/API.src/M000057.html +0 -27
  38. data/doc/classes/Win32/Console/API.src/M000058.html +0 -47
  39. data/doc/classes/Win32/Console/API.src/M000059.html +0 -32
  40. data/doc/classes/Win32/Console/API.src/M000060.html +0 -47
  41. data/doc/classes/Win32/Console/API.src/M000061.html +0 -34
  42. data/doc/classes/Win32/Console/API.src/M000062.html +0 -32
  43. data/doc/classes/Win32/Console/API.src/M000063.html +0 -32
  44. data/doc/classes/Win32/Console/API.src/M000064.html +0 -35
  45. data/doc/classes/Win32/Console/API.src/M000065.html +0 -26
  46. data/doc/classes/Win32/Console/API.src/M000066.html +0 -27
  47. data/doc/classes/Win32/Console/API.src/M000067.html +0 -29
  48. data/doc/classes/Win32/Console/API.src/M000068.html +0 -27
  49. data/doc/classes/Win32/Console/API.src/M000069.html +0 -27
  50. data/doc/classes/Win32/Console/API.src/M000070.html +0 -28
  51. data/doc/classes/Win32/Console/API.src/M000071.html +0 -27
  52. data/doc/classes/Win32/Console/API.src/M000072.html +0 -26
  53. data/doc/classes/Win32/Console/API.src/M000073.html +0 -27
  54. data/doc/classes/Win32/Console/API.src/M000074.html +0 -31
  55. data/doc/classes/Win32/Console/API.src/M000075.html +0 -27
  56. data/doc/classes/Win32/Console/API.src/M000076.html +0 -32
  57. data/doc/classes/Win32/Console/API.src/M000077.html +0 -27
  58. data/doc/classes/Win32/Console/API.src/M000078.html +0 -32
  59. data/doc/classes/Win32/Console/API.src/M000079.html +0 -32
  60. data/doc/classes/Win32/Console/API.src/M000080.html +0 -32
  61. data/doc/classes/Win32/Console/Constants.html +0 -360
  62. data/doc/classes/Win32/Console.html +0 -650
  63. data/doc/classes/Win32/Console.src/M000001.html +0 -31
  64. data/doc/classes/Win32/Console.src/M000002.html +0 -23
  65. data/doc/classes/Win32/Console.src/M000003.html +0 -23
  66. data/doc/classes/Win32/Console.src/M000004.html +0 -27
  67. data/doc/classes/Win32/Console.src/M000005.html +0 -23
  68. data/doc/classes/Win32/Console.src/M000006.html +0 -28
  69. data/doc/classes/Win32/Console.src/M000007.html +0 -23
  70. data/doc/classes/Win32/Console.src/M000008.html +0 -24
  71. data/doc/classes/Win32/Console.src/M000009.html +0 -44
  72. data/doc/classes/Win32/Console.src/M000010.html +0 -23
  73. data/doc/classes/Win32/Console.src/M000011.html +0 -33
  74. data/doc/classes/Win32/Console.src/M000012.html +0 -26
  75. data/doc/classes/Win32/Console.src/M000013.html +0 -27
  76. data/doc/classes/Win32/Console.src/M000014.html +0 -28
  77. data/doc/classes/Win32/Console.src/M000015.html +0 -23
  78. data/doc/classes/Win32/Console.src/M000016.html +0 -23
  79. data/doc/classes/Win32/Console.src/M000017.html +0 -23
  80. data/doc/classes/Win32/Console.src/M000018.html +0 -29
  81. data/doc/classes/Win32/Console.src/M000019.html +0 -23
  82. data/doc/classes/Win32/Console.src/M000020.html +0 -23
  83. data/doc/classes/Win32/Console.src/M000021.html +0 -28
  84. data/doc/classes/Win32/Console.src/M000022.html +0 -23
  85. data/doc/classes/Win32/Console.src/M000023.html +0 -28
  86. data/doc/classes/Win32/Console.src/M000024.html +0 -35
  87. data/doc/classes/Win32/Console.src/M000025.html +0 -28
  88. data/doc/classes/Win32/Console.src/M000026.html +0 -28
  89. data/doc/classes/Win32/Console.src/M000027.html +0 -28
  90. data/doc/classes/Win32/Console.src/M000028.html +0 -31
  91. data/doc/classes/Win32/Console.src/M000029.html +0 -23
  92. data/doc/classes/Win32/Console.src/M000030.html +0 -23
  93. data/doc/classes/Win32/Console.src/M000031.html +0 -23
  94. data/doc/classes/Win32/Console.src/M000032.html +0 -27
  95. data/doc/classes/Win32/Console.src/M000033.html +0 -27
  96. data/doc/classes/Win32/Console.src/M000034.html +0 -25
  97. data/doc/classes/Win32.html +0 -115
  98. data/doc/created.rid +0 -1
  99. data/doc/files/Console_ANSI_rdoc.html +0 -407
  100. data/doc/files/Console_cpp.html +0 -104
  101. data/doc/files/Console_rdoc.html +0 -964
  102. data/doc/files/lib/Win32/Console/ANSI_rb.html +0 -123
  103. data/doc/files/lib/Win32/Console_rb.html +0 -297
  104. data/doc/fr_class_index.html +0 -32
  105. data/doc/fr_file_index.html +0 -31
  106. data/doc/fr_method_index.html +0 -106
  107. data/doc/index.html +0 -24
  108. data/doc/rdoc-style.css +0 -172
data/lib/Win32/Console.rb CHANGED
@@ -9,6 +9,7 @@ begin
9
9
  # equivalent functions in ruby (a tad slower)
10
10
  # That dll should define everything in an identical interface
11
11
  # to all the ruby code that the rescue below defines.
12
+ #raise
12
13
  require "Console.so"
13
14
  STDERR.print "Using faster, DLL Console.so\n" if $DEBUG
14
15
 
@@ -16,604 +17,11 @@ rescue Exception
16
17
 
17
18
  STDERR.print "Using slower, non-DLL Console.rb\n" if $DEBUG
18
19
 
19
- module Win32
20
- class Console
21
- end
22
- end
23
-
24
- # The WINDOWS constants
25
- module Win32::Console::Constants
26
- STD_INPUT_HANDLE = 0xFFFFFFF6
27
- STD_OUTPUT_HANDLE = 0xFFFFFFF5
28
- STD_ERROR_HANDLE = 0xFFFFFFF4
29
- INVALID_HANDLE_VALUE = 0xFFFFFFFF
30
- GENERIC_READ = 0x80000000
31
- GENERIC_WRITE = 0x40000000
32
- FILE_SHARE_READ = 0x00000001
33
- FILE_SHARE_WRITE = 0x00000002
34
- CONSOLE_TEXTMODE_BUFFER = 0x00000001
35
-
36
- FOREGROUND_BLUE = 0x0001
37
- FOREGROUND_GREEN = 0x0002
38
- FOREGROUND_RED = 0x0004
39
- FOREGROUND_INTENSITY = 0x0008
40
- BACKGROUND_BLUE = 0x0010
41
- BACKGROUND_GREEN = 0x0020
42
- BACKGROUND_RED = 0x0040
43
- BACKGROUND_INTENSITY = 0x0080
44
-
45
- ENABLE_PROCESSED_INPUT = 0x0001
46
- ENABLE_LINE_INPUT = 0x0002
47
- ENABLE_ECHO_INPUT = 0x0004
48
- ENABLE_WINDOW_INPUT = 0x0008
49
- ENABLE_MOUSE_INPUT = 0x0010
50
- ENABLE_PROCESSED_OUTPUT = 0x0001
51
- ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002
52
-
53
- KEY_EVENT = 0x0001
54
- MOUSE_EVENT = 0x0002
55
- WINDOW_BUFFER_SIZE_EVENT = 0x0004
56
- MENU_EVENT = 0x0008
57
- FOCUS_EVENT = 0x0010
58
-
59
- CAPSLOCK_ON = 0x0080
60
- ENHANCED_KEY = 0x0100
61
- NUMLOCK_ON = 0x0020
62
- SHIFT_PRESSED = 0x0010
63
- LEFT_CTRL_PRESSED = 0x0008
64
- RIGHT_CTRL_PRESSED = 0x0004
65
- LEFT_ALT_PRESSED = 0x0002
66
- RIGHT_ALT_PRESSED = 0x0001
67
- SCROLLLOCK_ON = 0x0040
68
-
69
- MOUSE_WHEELED = 0x0004
70
- DOUBLE_CLICK = 0x0002
71
- MOUSE_MOVED = 0x0001
72
-
73
- FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001
74
- FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004
75
- FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008
76
- FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010
77
- RIGHTMOST_BUTTON_PRESSED = 0x0002
78
-
79
- CTRL_C_EVENT = 0x0000
80
- CTRL_BREAK_EVENT = 0x0001
81
- CTRL_CLOSE_EVENT = 0x0002
82
- CTRL_LOGOFF_EVENT = 0x0005
83
- CTRL_SHUTDOWN_EVENT = 0x0006
84
- end
85
-
86
- # The actual api to access windows functions
87
- class Win32::Console::API
88
- require 'Win32API'
89
-
90
- private
91
- # This is a class-wide cache that will hold Win32API objects. As each
92
- # Win32API object is about 920 bytes, I didn't want to initialize all of
93
- # them at one time. That would waste about 42 kB for this object because
94
- # it has 47 functions. However, to not have a cache at all would reduce
95
- # the speed of this object by 164%.
96
- @@m_AllocConsole = nil
97
- @@m_CreateConsoleScreenBuffer = nil
98
- @@m_FillConsoleOutputAttribute = nil
99
- @@m_FillConsoleOutputCharacter = nil
100
- @@m_FlushConsoleInputBuffer = nil
101
- @@m_FreeConsole = nil
102
- @@m_GenerateConsoleCtrlEvent = nil
103
- @@m_GetConsoleCP = nil
104
- @@m_GetConsoleCursorInfo = nil
105
- @@m_GetConsoleMode = nil
106
- @@m_GetConsoleOutputCP = nil
107
- @@m_GetConsoleScreenBufferInfo = nil
108
- @@m_GetConsoleTitle = nil
109
- @@m_GetConsoleWindow = nil
110
- @@m_GetLargestConsoleWindowSize = nil
111
- @@m_GetNumberOfConsoleInputEvents = nil
112
- @@m_GetNumberOfConsoleMouseButtons = nil
113
- @@m_GetStdHandle = nil
114
- @@m_PeekConsoleInput = nil
115
- @@m_ReadConsole = nil
116
- @@m_ReadConsoleInput = nil
117
- @@m_ReadConsoleOutput = nil
118
- @@m_ReadConsoleOutputAttribute = nil
119
- @@m_ReadConsoleOutputCharacter = nil
120
- @@m_ScrollConsoleScreenBuffer = nil
121
- @@m_SetConsoleActiveScreenBuffer = nil
122
- @@m_SetConsoleCP = nil
123
- @@m_SetConsoleCursorInfo = nil
124
- @@m_SetConsoleCursorPosition = nil
125
- @@m_SetConsoleMode = nil
126
- @@m_SetConsoleOutputCP = nil
127
- @@m_SetConsoleScreenBufferSize = nil
128
- @@m_SetConsoleTextAttribute = nil
129
- @@m_SetConsoleTitle = nil
130
- @@m_SetConsoleWindowInfo = nil
131
- @@m_SetStdHandle = nil
132
- @@m_WriteConsole = nil
133
- @@m_WriteConsoleInput = nil
134
- @@m_WriteConsoleOutput = nil
135
- @@m_WriteConsoleOutputAttribute = nil
136
- @@m_WriteConsoleOutputCharacter = nil
137
-
138
- public
139
-
140
- class << self
141
-
142
-
143
- def constant(t)
144
- begin
145
- eval "return Win32::Console::Constants::#{t}"
146
- rescue
147
- return nil
148
- end
149
- end
150
-
151
-
152
- def AllocConsole()
153
- if @@m_AllocConsole == nil
154
- @@m_AllocConsole = Win32API.new( "kernel32", "AllocConsole",
155
- [], 'l' )
156
- end
157
- @@m_AllocConsole.call()
158
- end
159
-
160
- def CreateConsoleScreenBuffer( dwDesiredAccess, dwShareMode, dwFlags )
161
- if @@m_CreateConsoleScreenBuffer == nil
162
- @@m_CreateConsoleScreenBuffer = Win32API.new( "kernel32", "CreateConsoleScreenBuffer", ['l', 'l', 'p', 'l', 'p'], 'l' )
163
- end
164
- @@m_CreateConsoleScreenBuffer.call( dwDesiredAccess, dwShareMode,
165
- nil, dwFlags, nil )
166
- end
167
-
168
-
169
-
170
- def FillConsoleOutputAttribute( hConsoleOutput, wAttribute, nLength,
171
- col, row )
172
- if @@m_FillConsoleOutputAttribute == nil
173
- @@m_FillConsoleOutputAttribute = Win32API.new( "kernel32", "FillConsoleOutputAttribute", ['l', 'i', 'l', 'l', 'p'], 'l' )
174
- end
175
- dwWriteCoord = (row << 16) + col
176
- lpNumberOfAttrsWritten = ' ' * 4
177
- @@m_FillConsoleOutputAttribute.call( hConsoleOutput, wAttribute,
178
- nLength, dwWriteCoord,
179
- lpNumberOfAttrsWritten )
180
- return lpNumberOfAttrsWritten.unpack('L')
181
- end
182
-
183
-
184
-
185
- def FillConsoleOutputCharacter( hConsoleOutput, cCharacter, nLength,
186
- col, row )
187
- if @@m_FillConsoleOutputCharacter == nil
188
- @@m_FillConsoleOutputCharacter = Win32API.new( "kernel32", "FillConsoleOutputCharacter", ['l', 'i', 'l', 'l', 'p'], 'l' )
189
- end
190
- dwWriteCoord = (row << 16) + col
191
- lpNumberOfAttrsWritten = ' ' * 4
192
- @@m_FillConsoleOutputCharacter.call( hConsoleOutput, cCharacter,
193
- nLength, dwWriteCoord,
194
- lpNumberOfAttrsWritten )
195
- return lpNumberOfAttrsWritten.unpack('L')
196
- end
197
-
198
-
199
- def FlushConsoleInputBuffer( hConsoleInput )
200
- if @@m_FlushConsoleInputBuffer == nil
201
- @@m_FlushConsoleInputBuffer = Win32API.new( "kernel32",
202
- "FillConsoleInputBuffer",
203
- ['l'], 'l' )
204
- end
205
- @@m_FlushConsoleInputBuffer.call( hConsoleInput )
206
- end
207
-
208
-
209
- def FreeConsole()
210
- if @@m_FreeConsole == nil
211
- @@m_FreeConsole = Win32API.new( "kernel32", "FreeConsole", [], 'l' )
212
- end
213
- @@m_FreeConsole.call()
214
- end
215
-
216
-
217
- def GenerateConsoleCtrlEvent( dwCtrlEvent, dwProcessGroupId )
218
- if @@m_GenerateConsoleCtrlEvent == nil
219
- @@m_GenerateConsoleCtrlEvent = Win32API.new( "kernel32", "GenerateConsoleCtrlEvent", ['l', 'l'], 'l' )
220
- end
221
- @@m_GenerateConsoleCtrlEvent.call( dwCtrlEvent, dwProcessGroupId )
222
- end
223
-
224
- def GetConsoleCP()
225
- if @@m_GetConsoleCP == nil
226
- @@m_GetConsoleCP = Win32API.new( "kernel32", "GetConsoleCP",
227
- [], 'l' )
228
- end
229
- @@m_GetConsoleCP.call()
230
- end
231
-
232
- def GetConsoleCursorInfo( hConsoleOutput )
233
- if @@m_GetConsoleCursorInfo == nil
234
- @@m_GetConsoleCursorInfo = Win32API.new( "kernel32",
235
- "GetConsoleCursorInfo",
236
- ['l', 'p'], 'l' )
237
- end
238
- lpConsoleCursorInfo = ' ' * 8
239
- @@m_GetConsoleCursorInfo.call( hConsoleOutput, lpConsoleCursorInfo )
240
- return lpConsoleCursorInfo.unpack('LL')
241
- end
242
-
243
- def GetConsoleMode( hConsoleHandle )
244
- if @@m_GetConsoleMode == nil
245
- @@m_GetConsoleMode = Win32API.new( "kernel32", "GetConsoleMode",
246
- ['l', 'p'], 'l' )
247
- end
248
- lpMode = ' ' * 4
249
- @@m_GetConsoleMode.call( hConsoleHandle, lpMode )
250
- return lpMode.unpack('L')
251
- end
252
-
253
- def GetConsoleOutputCP()
254
- if @@m_GetConsoleOutputCP == nil
255
- @@m_GetConsoleOutputCP = Win32API.new( "kernel32",
256
- "GetConsoleOutputCP", [], 'l' )
257
- end
258
- @@m_GetConsoleOutputCP.call()
259
- end
260
-
261
- def GetConsoleScreenBufferInfo( hConsoleOutput )
262
- if @@m_GetConsoleScreenBufferInfo == nil
263
- @@m_GetConsoleScreenBufferInfo = Win32API.new( "kernel32", "GetConsoleScreenBufferInfo", ['l', 'p'], 'l' )
264
- end
265
- lpBuffer = ' ' * 22
266
- @@m_GetConsoleScreenBufferInfo.call( hConsoleOutput, lpBuffer )
267
- return lpBuffer.unpack('SSSSSssssSS')
268
- end
269
-
270
- def GetConsoleTitle()
271
- if @@m_GetConsoleTitle == nil
272
- @@m_GetConsoleTitle = Win32API.new( "kernel32", "GetConsoleTitle",
273
- ['p', 'l'], 'l' )
274
- end
275
- nSize = 120
276
- lpConsoleTitle = ' ' * nSize
277
- @@m_GetConsoleTitle.call( lpConsoleTitle, nSize )
278
- return lpConsoleTitle.strip
279
- end
280
-
281
- def GetConsoleWindow()
282
- if @@m_GetConsoleWindow == nil
283
- @@m_GetConsoleWindow = Win32API.new( "kernel32", "GetConsoleWindow",
284
- [], 'l' )
285
- end
286
- @@m_GetConsoleWindow.call()
287
- end
288
-
289
- def GetLargestConsoleWindowSize( hConsoleOutput )
290
- if @@m_GetLargestConsoleWindowSize == nil
291
- @@m_GetLargestConsoleWindowSize = Win32API.new( "kernel32", "GetLargestConsoleWindowSize", ['l'], 'l' )
292
- end
293
- coord = @@m_GetLargestConsoleWindowSize.call( hConsoleOutput )
294
- x = coord >> 16
295
- y = coord & 0x0000ffff
296
- return [x,y]
297
- end
298
-
299
- def GetNumberOfConsoleInputEvents( hConsoleInput )
300
- if @@m_GetNumberOfConsoleInputEvents == nil
301
- @@m_GetNumberOfConsoleInputEvents = Win32API.new( "kernel32", "GetNumberOfConsoleInputEvents", ['l', 'p'], 'l' )
302
- end
303
- lpcNumberOfEvents = 0
304
- @@m_GetNumberOfConsoleInputEvents.call( hConsoleInput,
305
- lpcNumberOfEvents )
306
- return lpcNumberOfEvents
307
- end
308
-
309
- def GetNumberOfConsoleMouseButtons( )
310
- if @@m_GetNumberOfConsoleMouseButtons == nil
311
- @@m_GetNumberOfConsoleMouseButtons = Win32API.new( "kernel32", "GetNumberOfConsoleMouseButtons", ['p'], 'l' )
312
- end
313
- lpNumberOfMouseButtons = 0
314
- @@m_GetNumberOfConsoleMouseButtons.call( lpNumberOfMouseButtons )
315
- return lpNumberOfMouseButtons
316
- end
317
-
318
- def GetStdHandle( nStdHandle )
319
- if @@m_GetStdHandle == nil
320
- @@m_GetStdHandle = Win32API.new( "kernel32", "GetStdHandle",
321
- ['l'], 'l' )
322
- end
323
- @@m_GetStdHandle.call( nStdHandle )
324
- end
325
-
326
- # <<HandlerRoutine>> : This is not an actual API function, just a concept description in the SDK.
327
-
328
- def PeekConsoleInput( hConsoleInput )
329
- if @@m_PeekConsoleInput == nil
330
- @@m_PeekConsoleInput = Win32API.new( "kernel32", "PeekConsoleInput",
331
- ['l', 'p', 'l', 'p'], 'l' )
332
- end
333
- lpNumberOfEventsRead = ' ' * 4
334
- lpBuffer = ' ' * 20
335
- nLength = 20
336
- @@m_PeekConsoleInput.call( hConsoleInput, lpBuffer, nLength,
337
- lpNumberOfEventsRead )
338
- type = lpBuffer.unpack('s')[0]
339
-
340
- case type
341
- when KEY_EVENT
342
- return lpBuffer.unpack('sSSSSCS')
343
- when MOUSE_EVENT
344
- return lpBuffer.unpack('sSSSS')
345
- when WINDOW_BUFFER_SIZE_EVENT
346
- return lpBuffer.unpack('sS')
347
- when MENU_EVENT
348
- return lpBuffer.unpack('sS')
349
- when FOCUS_EVENT
350
- return lpBuffer.unpack('sS')
351
- else
352
- return []
353
- end
354
- end
355
-
356
- def ReadConsole( hConsoleInput, lpBuffer, nNumberOfCharsToRead )
357
- if @@m_ReadConsole == nil
358
- @@m_ReadConsole = Win32API.new( "kernel32", "ReadConsole",
359
- ['l', 'p', 'l', 'p', 'p'], 'l' )
360
- end
361
- lpBuffer = ' ' * nNumberOfCharsToRead unless lpBuffer
362
- lpNumberOfCharsRead = ' ' * 4
363
- lpReserved = ' ' * 4
364
- @@m_ReadConsole.call( hConsoleInput, lpBuffer, nNumberOfCharsToRead,
365
- lpNumberOfCharsRead, lpReserved )
366
- return lpNumberOfCharsRead.unpack('L')
367
- end
368
-
369
- def ReadConsoleInput( hConsoleInput )
370
- if @@m_ReadConsoleInput == nil
371
- @@m_ReadConsoleInput = Win32API.new( "kernel32", "ReadConsoleInput",
372
- ['l', 'p', 'l', 'p'], 'l' )
373
- end
374
- lpNumberOfEventsRead = ' ' * 4
375
- lpBuffer = ' ' * 20
376
- nLength = 20
377
- @@m_ReadConsoleInput.call( hConsoleInput, lpBuffer, nLength,
378
- lpNumberOfEventsRead )
379
- type = lpBuffer.unpack('s')[0]
380
-
381
- case type
382
- when KEY_EVENT
383
- return lpBuffer.unpack('sSSSSCS')
384
- when MOUSE_EVENT
385
- return lpBuffer.unpack('sSSSS')
386
- when WINDOW_BUFFER_SIZE_EVENT
387
- return lpBuffer.unpack('sS')
388
- when MENU_EVENT
389
- return lpBuffer.unpack('sS')
390
- when FOCUS_EVENT
391
- return lpBuffer.unpack('sS')
392
- else
393
- return []
394
- end
395
- end
396
-
397
- def ReadConsoleOutput( hConsoleOutput, lpBuffer, cols, rows,
398
- bufx, bufy, left, top, right, bottom )
399
- if @@m_ReadConsoleOutput == nil
400
- @@m_ReadConsoleOutput = Win32API.new( "kernel32",
401
- "ReadConsoleOutput",
402
- ['l', 'p', 'l', 'l', 'p'], 'l' )
403
- end
404
- dwBufferSize = cols * rows * 4
405
- lpBuffer = ' ' * dwBufferSize
406
- dwBufferCoord = (bufy << 16) + bufx
407
- lpReadRegion = [ left, top, right, bottom ].pack('ssss')
408
- @@m_ReadConsoleOutput.call( hConsoleOutput, lpBuffer, dwBufferSize,
409
- dwBufferCoord, lpReadRegion )
410
- end
411
-
412
- def ReadConsoleOutputAttribute( hConsoleOutput, nLength, col, row )
413
- if @@m_ReadConsoleOutputAttribute == nil
414
- @@m_ReadConsoleOutputAttribute = Win32API.new( "kernel32", "ReadConsoleOutputAttribute", ['l', 'p', 'l', 'l', 'p'], 'l' )
415
- end
416
- lpAttribute = ' ' * nLength
417
- dwReadCoord = (row << 16) + col
418
- lpNumberOfAttrsRead = ' ' * 4
419
- @@m_ReadConsoleOutputAttribute.call( hConsoleOutput, lpAttribute,
420
- nLength, dwReadCoord,
421
- lpNumberOfAttrsRead )
422
- return lpAttribute
423
- end
424
-
425
- def ReadConsoleOutputCharacter( hConsoleOutput, lpCharacter, nLength,
426
- col, row )
427
- if @@m_ReadConsoleOutputCharacter == nil
428
- @@m_ReadConsoleOutputCharacter = Win32API.new( "kernel32", "ReadConsoleOutputCharacter", ['l', 'p', 'l', 'l', 'p'], 'l' )
429
- end
430
- dwReadCoord = (row << 16) + col
431
- lpNumberOfCharsRead = ' ' * 4
432
- @@m_ReadConsoleOutputCharacter.call( hConsoleOutput, lpCharacter,
433
- nLength, dwReadCoord,
434
- lpNumberOfCharsRead )
435
- return lpNumberOfCharsRead.unpack('L')
436
- end
437
-
438
- def ScrollConsoleScreenBuffer( hConsoleOutput,
439
- left1, top1, right1, bottom1,
440
- col, row, char, attr,
441
- left2, top2, right2, bottom2 )
442
- if @@m_ScrollConsoleScreenBuffer == nil
443
- @@m_ScrollConsoleScreenBuffer = Win32API.new( "kernel32", "ScrollConsoleScreenBuffer", ['l', 'p', 'p', 'l', 'p'], 'l' )
444
- end
445
- lpScrollRectangle = [left1, top1, right1, bottom1].pack('ssss')
446
- lpClipRectangle = [left2, top2, right2, bottom2].pack('ssss')
447
- dwDestinationOrigin = (row << 16) + col
448
- lpFill = [char, attr].pack('ss')
449
- @@m_ScrollConsoleScreenBuffer.call( hConsoleOutput, lpScrollRectangle,
450
- lpClipRectangle,
451
- dwDestinationOrigin, lpFill )
452
- end
453
-
454
- def SetConsoleActiveScreenBuffer( hConsoleOutput )
455
- if @@m_SetConsoleActiveScreenBuffer == nil
456
- @@m_SetConsoleActiveScreenBuffer = Win32API.new( "kernel32", "SetConsoleActiveScreenBuffer", ['l'], 'l' )
457
- end
458
- @@m_SetConsoleActiveScreenBuffer.call( hConsoleOutput )
459
- end
460
-
461
- # <<SetConsoleCtrlHandler>>: Will probably not be implemented.
462
-
463
- def SetConsoleCP( wCodePageID )
464
- if @@m_SetConsoleCP == nil
465
- @@m_SetConsoleCP = Win32API.new( "kernel32", "SetConsoleCP",
466
- ['l'], 'l' )
467
- end
468
- @@m_SetConsoleCP.call( wCodePageID )
469
- end
470
-
471
- def SetConsoleCursorInfo( hConsoleOutput, col, row )
472
- if @@m_SetConsoleCursorInfo == nil
473
- @@m_SetConsoleCursorInfo = Win32API.new( "kernel32",
474
- "SetConsoleCursorInfo",
475
- ['l', 'p'], 'l' )
476
- end
477
- lpConsoleCursorInfo = [size,visi].pack('LL')
478
- @@m_SetConsoleCursorInfo.call( hConsoleOutput, lpConsoleCursorInfo )
479
- end
480
-
481
- def SetConsoleCursorPosition( hConsoleOutput, col, row )
482
- if @@m_SetConsoleCursorPosition == nil
483
- @@m_SetConsoleCursorPosition = Win32API.new( "kernel32", "SetConsoleCursorPosition", ['l', 'p'], 'l' )
484
- end
485
- dwCursorPosition = (row << 16) + col
486
- @@m_SetConsoleCursorPosition.call( hConsoleOutput, dwCursorPosition )
487
- end
488
-
489
- def SetConsoleMode( hConsoleHandle, lpMode )
490
- if @@m_SetConsoleMode == nil
491
- @@m_SetConsoleMode = Win32API.new( "kernel32", "SetConsoleMode",
492
- ['l', 'p'], 'l' )
493
- end
494
- @@m_SetConsoleMode.call( hConsoleHandle, lpMode )
495
- end
496
-
497
- def SetConsoleOutputCP( wCodePageID )
498
- if @@m_SetConsoleOutputCP == nil
499
- @@m_SetConsoleOutputCP = Win32API.new( "kernel32",
500
- "GetConsoleOutputCP",
501
- ['l'], 'l' )
502
- end
503
- @@m_SetConsoleOutputCP.call( wCodePageID )
504
- end
505
-
506
- def SetConsoleScreenBufferSize( hConsoleOutput, col, row )
507
- if @@m_SetConsoleScreenBufferSize == nil
508
- @@m_SetConsoleScreenBufferSize = Win32API.new( "kernel32", "SetConsoleScreenBufferSize", ['l', 'l'], 'l' )
509
- end
510
- dwSize = (row << 16) + col
511
- @@m_SetConsoleScreenBufferSize.call( hConsoleOutput, dwSize )
512
- end
513
-
514
- def SetConsoleTextAttribute( hConsoleOutput, wAttributes )
515
- if @@m_SetConsoleTextAttribute == nil
516
- @@m_SetConsoleTextAttribute = Win32API.new( "kernel32", "SetConsoleTextAttribute", ['l', 'i'], 'l' )
517
- end
518
- @@m_SetConsoleTextAttribute.call( hConsoleOutput, wAttributes )
519
- end
520
-
521
- def SetConsoleTitle( lpConsoleTitle )
522
- if @@m_SetConsoleTitle == nil
523
- @@m_SetConsoleTitle = Win32API.new( "kernel32", "SetConsoleTitle",
524
- ['p'], 'l' )
525
- end
526
- @@m_SetConsoleTitle.call( lpConsoleTitle )
527
- end
528
-
529
- def SetConsoleWindowInfo( hConsoleOutput, bAbsolute,
530
- left, top, right, bottom )
531
- if @@m_SetConsoleWindowInfo == nil
532
- @@m_SetConsoleWindowInfo = Win32API.new( "kernel32",
533
- "SetConsoleWindowInfo",
534
- ['l', 'l', 'p'], 'l' )
535
- end
536
- lpConsoleWindow = [ left, top, right, bottom ].pack('ssss')
537
- @@m_SetConsoleWindowInfo.call( hConsoleOutput, bAbsolute,
538
- lpConsoleWindow )
539
- end
540
-
541
- def SetStdHandle( nStdHandle, hHandle )
542
- if @@m_SetStdHandle == nil
543
- @@m_SetStdHandle = Win32API.new( "kernel32", "SetStdHandle",
544
- ['l', 'l'], 'l' )
545
- end
546
- @@m_SetStdHandle.call( nStdHandle, hHandle )
547
- end
548
-
549
- def WriteConsole( hConsoleOutput, lpBuffer )
550
- if @@m_WriteConsole == nil
551
- @@m_WriteConsole = Win32API.new( "kernel32", "WriteConsole",
552
- ['l', 'p', 'l', 'p', 'p'], 'l' )
553
- end
554
- nNumberOfCharsToWrite = lpBuffer.length()
555
- lpNumberOfCharsWritten = ' ' * 4
556
- lpReserved = ' ' * 4
557
- @@m_WriteConsole.call( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
558
- lpNumberOfCharsWritten, lpReserved )
559
- return lpNumberOfCharsWritten
560
- end
561
-
562
- def WriteConsoleInput( hConsoleInput, lpBuffer )
563
- if @@m_WriteConsoleInput == nil
564
- @@m_WriteConsoleInput = Win32API.new( "kernel32", "WriteConsoleInput", ['l', 'p', 'l', 'p'], 'l' )
565
- end
566
- @@m_WriteConsoleInput.call( hConsoleInput, lpBuffer, nLength,
567
- lpNumberOfEventsWritten )
568
- end
569
-
570
- # @@ Todo: Test this
571
- def WriteConsoleOutput( hConsoleOutput, buffer, cols, rows,
572
- bufx, bufy, left, top, right, bottom )
573
- if @@m_WriteConsoleOutput == nil
574
- @@m_WriteConsoleOutput = Win32API.new( "kernel32", "WriteConsoleOutput", ['l', 'p', 'l', 'l', 'p'], 'l' )
575
- end
576
- lpBuffer = buffer.flatten.pack('ss' * buffer.length() * 2)
577
- dwBufferSize = (buffer.length() << 16) + 2
578
- dwBufferCoord = (row << 16) + col
579
- lpWriteRegion = [ left, top, right, bottom ].pack('ssss')
580
- @@m_WriteConsoleOutput.call( hConsoleOutput, lpBuffer, dwBufferSize,
581
- dwBufferCoord, lpWriteRegion )
582
- end
583
-
584
- def WriteConsoleOutputAttribute( hConsoleOutput, lpAttribute, col, row )
585
- if @@m_WriteConsoleOutputAttribute == nil
586
- @@m_WriteConsoleOutputAttribute = Win32API.new( "kernel32", "WriteConsoleOutputAttribute", ['l', 'p', 'l', 'l', 'p'], 'l' )
587
- end
588
- nLength = lpAttribute.length()
589
- dwWriteCoord = (row << 16) + col
590
- lpNumberOfAttrsWritten = ' ' * 4
591
- @@m_WriteConsoleOutputAttribute.call( hConsoleOutput, lpAttribute,
592
- nLength, dwWriteCoord,
593
- lpNumberOfAttrsWritten )
594
- return lpNumberOfAttrsWritten.unpack('L')
595
- end
596
-
597
- def WriteConsoleOutputCharacter( hConsoleOutput, lpCharacter, col, row )
598
- if @@m_WriteConsoleOutputCharacter == nil
599
- @@m_WriteConsoleOutputCharacter = Win32API.new( "kernel32", "WriteConsoleOutputCharacter", ['l', 'p', 'l', 'l', 'p'], 'l' )
600
- end
601
- nLength = lpCharacter.length()
602
- dwWriteCoord = (row << 16) + col
603
- lpNumberOfCharsWritten = ' ' * 4
604
- @@m_WriteConsoleOutputCharacter.call( hConsoleOutput, lpCharacter,
605
- nLength, dwWriteCoord,
606
- lpNumberOfCharsWritten )
607
- return lpNumberOfCharsWritten.unpack('L')
608
- end
609
-
610
- end
611
- end
20
+ require 'Win32/Console/constants.rb'
21
+ require 'Win32/Console/api.rb'
612
22
 
613
23
  end # rescue
614
24
 
615
-
616
-
617
25
  module Win32
618
26
  class Console
619
27
 
@@ -623,17 +31,16 @@ module Win32
623
31
 
624
32
  def initialize( t = nil )
625
33
  if t and ( t == STD_INPUT_HANDLE or t == STD_OUTPUT_HANDLE or
626
- t == STD_ERROR_HANDLE )
627
- @handle = API.GetStdHandle( t )
34
+ t == STD_ERROR_HANDLE )
35
+ @handle = API.GetStdHandle( t )
628
36
  else
629
- param1 = GENERIC_READ | GENERIC_WRITE
630
- param2 = FILE_SHARE_READ | FILE_SHARE_WRITE
631
- @handle = API.CreateConsoleScreenBuffer( param1, param2,
632
- CONSOLE_TEXTMODE_BUFFER )
37
+ param1 = GENERIC_READ | GENERIC_WRITE
38
+ param2 = FILE_SHARE_READ | FILE_SHARE_WRITE
39
+ @handle = API.CreateConsoleScreenBuffer( param1, param2,
40
+ CONSOLE_TEXTMODE_BUFFER )
633
41
  end
634
42
  end
635
43
 
636
-
637
44
  def Display
638
45
  return API.SetConsoleActiveScreenBuffer(@handle)
639
46
  end
@@ -644,9 +51,9 @@ module Win32
644
51
 
645
52
  def Title(title = nil)
646
53
  if title
647
- return API.SetConsoleTitle(title)
54
+ return API.SetConsoleTitle(title)
648
55
  else
649
- return API.GetConsoleTitle()
56
+ return API.GetConsoleTitle()
650
57
  end
651
58
  end
652
59
 
@@ -657,9 +64,9 @@ module Win32
657
64
  def ReadChar(size, col, row)
658
65
  buffer = ' ' * size
659
66
  if API.ReadConsoleOutputCharacter( @handle, buffer, size, col, row )
660
- return buffer
67
+ return buffer
661
68
  else
662
- return nil
69
+ return nil
663
70
  end
664
71
  end
665
72
 
@@ -672,28 +79,27 @@ module Win32
672
79
  return x.unpack('c'*size)
673
80
  end
674
81
 
675
-
676
82
  def Cursor(*t)
677
83
  col, row, size, visi = t
678
84
  if col
679
- row = -1 if !row
680
- if col < 0 or row < 0
681
- curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
682
- col = curr_col if col < 0
683
- row = curr_row if row < 0
684
- end
685
- API.SetConsoleCursorPosition( @handle, col, row )
686
- if size and visi
687
- curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
688
- size = curr_size if size < 0
689
- visi = curr_visi if visi < 0
690
- size = 1 if size < 1
691
- size = 99 if size > 99
692
- API.SetConsoleCursorInfo( @handle, size, visi )
693
- end
85
+ row = -1 if !row
86
+ if col < 0 or row < 0
87
+ curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
88
+ col = curr_col if col < 0
89
+ row = curr_row if row < 0
90
+ end
91
+ API.SetConsoleCursorPosition( @handle, col, row )
92
+ if size and visi
93
+ curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
94
+ size = curr_size if size < 0
95
+ visi = curr_visi if visi < 0
96
+ size = 1 if size < 1
97
+ size = 99 if size > 99
98
+ API.SetConsoleCursorInfo( @handle, size, visi )
99
+ end
694
100
  else
695
- d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
696
- curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
101
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
102
+ curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
697
103
  return [ curr_col, curr_row, curr_size, curr_visi ]
698
104
  end
699
105
  end
@@ -702,58 +108,56 @@ module Win32
702
108
  API.WriteConsole( @handle, s )
703
109
  end
704
110
 
111
+ def WriteFile(s)
112
+ API.WriteFile( @handle, s)
113
+ end
114
+
705
115
  def ReadRect( left, top, right, bottom )
706
116
  col = right - left + 1
707
117
  row = bottom - top + 1
708
118
  size = col * row
709
119
  buffer = ' ' * size * 4
710
- if API.ReadConsoleOutput( @handle, buffer, col, row, 0, 0,
711
- left, top, right, bottom )
712
- #return buffer.unpack('US'*size) # for unicode
713
- return buffer.unpack('axS'*size) # for ascii
120
+ if API.ReadConsoleOutput( @handle, buffer, col, row, 0, 0,
121
+ left, top, right, bottom )
122
+ #return buffer.unpack('US'*size) # for unicode
123
+ return buffer.unpack('axS'*size) # for ascii
714
124
  else
715
- return nil
125
+ return nil
716
126
  end
717
127
  end
718
128
 
719
129
  def WriteRect( buffer, left, top, right, bottom )
720
130
  col = right - left + 1
721
131
  row = bottom - top + 1
722
- API.WriteConsoleOutput( @handle, buffer, col, row, 0, 0,
723
- left, top, right, bottom )
132
+ API.WriteConsoleOutput( @handle, buffer, col, row, 0, 0,
133
+ left, top, right, bottom )
724
134
  end
725
135
 
726
-
727
-
728
136
  def Scroll( left1, top1, right1, bottom1,
729
- col, row, char, attr,
730
- left2, top2, right2, bottom2 )
137
+ col, row, char, attr,
138
+ left2, top2, right2, bottom2 )
731
139
  API.ScrollConsoleScreenBuffer(@handle, left1, top1, right1, bottom1,
732
- col, row, char, attr,
733
- left2, top2, right2, bottom2)
140
+ col, row, char, attr,
141
+ left2, top2, right2, bottom2)
734
142
  end
735
143
 
736
-
737
144
  def MaxWindow(flag = nil)
738
145
  if !flag
739
- info = API.GetConsoleScreenBufferInfo(@handle)
146
+ info = API.GetConsoleScreenBufferInfo(@handle)
740
147
  return info[9], info[10]
741
148
  else
742
149
  return API.GetLargestConsoleWindowSize(@handle)
743
150
  end
744
151
  end
745
152
 
746
-
747
153
  def Info()
748
154
  return API.GetConsoleScreenBufferInfo( @handle )
749
155
  end
750
156
 
751
-
752
157
  def GetEvents()
753
158
  return API.GetNumberOfConsoleInputEvents(@handle)
754
159
  end
755
160
 
756
-
757
161
  def Flush()
758
162
  return API.FlushConsoleInputBuffer(@handle)
759
163
  end
@@ -762,29 +166,31 @@ module Win32
762
166
  number = 1 unless number
763
167
  buffer = ' ' * number
764
168
  if API.ReadConsole(@handle, buffer, number) == number
765
- return buffer
169
+ return buffer
766
170
  else
767
- return nil
171
+ return nil
768
172
  end
769
173
  end
770
174
 
771
-
772
175
  def Input()
773
176
  API.ReadConsoleInput(@handle)
774
177
  end
775
178
 
776
-
777
179
  def PeekInput()
778
180
  API.PeekConsoleInput(@handle)
779
181
  end
780
182
 
781
-
782
183
  def Mode(mode = nil)
783
184
  if mode
784
- mode = mode.pack('L') if mode === Array
785
- API.SetConsoleMode(@handle, mode)
185
+ mode = mode.pack('L') if mode === Array
186
+ API.SetConsoleMode(@handle, mode)
786
187
  else
787
- return API.GetConsoleMode(@handle)
188
+ begin
189
+ x = API.GetConsoleMode(@handle)
190
+ return x
191
+ rescue
192
+ return 9999
193
+ end
788
194
  end
789
195
  end
790
196
 
@@ -794,42 +200,41 @@ module Win32
794
200
 
795
201
  def Attr(*attr)
796
202
  if attr.size > 0
797
- API.SetConsoleTextAttribute( @handle, attr[0] )
203
+ API.SetConsoleTextAttribute( @handle, attr[0] )
798
204
  else
799
- info = API.GetConsoleScreenBufferInfo( @handle )
800
- return info[4]
205
+ info = API.GetConsoleScreenBufferInfo( @handle )
206
+ return info[4]
801
207
  end
802
208
  end
803
209
 
804
-
805
210
  def Size(*t)
806
211
  if t.size == 0
807
- col, row = API.GetConsoleScreenBufferInfo(@handle )
212
+ col, row = API.GetConsoleScreenBufferInfo(@handle )
808
213
  return [col, row]
809
214
  else
810
- row = -1 if !t[1]
811
- col = -1 if !t[0]
812
- if col < 0 or row < 0
813
- curr_col, curr_row = Size()
814
- col = curr_col if col < 0
815
- row = curr_row if row < 0
816
- end
817
- API.SetConsoleScreenBufferSize(@handle, row, col)
215
+ row = -1 if !t[1]
216
+ col = -1 if !t[0]
217
+ if col < 0 or row < 0
218
+ curr_col, curr_row = Size()
219
+ col = curr_col if col < 0
220
+ row = curr_row if row < 0
221
+ end
222
+ API.SetConsoleScreenBufferSize(@handle, row, col)
818
223
  end
819
224
  end
820
225
 
821
226
  def Window(*t)
822
227
  if t.size != 5
823
- info = API.GetConsoleScreenBufferInfo( @handle )
824
- return info[5..8]
228
+ info = API.GetConsoleScreenBufferInfo( @handle )
229
+ return info[5..8]
825
230
  else
826
- API.SetConsoleWindowInfo(@handle, t[0], t[1], t[2], t[3], t[4])
231
+ API.SetConsoleWindowInfo(@handle, t[0], t[1], t[2], t[3], t[4])
827
232
  end
828
233
  end
829
234
 
830
235
  def FillAttr(attr, number = 1, col = -1, row = -1)
831
236
  if col < 0 or row < 0
832
- d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
237
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
833
238
  col = curr_col if col < 0
834
239
  row = curr_row if row < 0
835
240
  end
@@ -838,7 +243,7 @@ module Win32
838
243
 
839
244
  def FillChar(char, number, col = -1, row = -1)
840
245
  if col < 0 or row < 0
841
- d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
246
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
842
247
  col = curr_col if col < 0
843
248
  row = curr_row if row < 0
844
249
  end
@@ -871,17 +276,17 @@ module Win32
871
276
 
872
277
  def Console.InputCP(codepage=nil)
873
278
  if codepage
874
- API.SetConsoleCP(codepage)
279
+ API.SetConsoleCP(codepage)
875
280
  else
876
- return API.GetConsoleCP()
281
+ return API.GetConsoleCP()
877
282
  end
878
283
  end
879
284
 
880
285
  def Console.OutputCP(codepage=nil)
881
286
  if codepage
882
- API.SetConsoleOutputCP(codepage)
287
+ API.SetConsoleOutputCP(codepage)
883
288
  else
884
- return API.GetConsoleOutputCP()
289
+ return API.GetConsoleOutputCP()
885
290
  end
886
291
  end
887
292
 
@@ -895,9 +300,6 @@ module Win32
895
300
  end
896
301
 
897
302
 
898
-
899
-
900
-
901
303
  FG_BLACK = 0
902
304
  FG_BLUE = Win32::Console::API.constant("FOREGROUND_BLUE")
903
305
  FG_LIGHTBLUE = Win32::Console::API.constant("FOREGROUND_BLUE")|