Module: Windows::Console

Defined in:
lib/windows/console.rb

Constant Summary collapse

CTRL_C_EVENT =
0
CTRL_BREAK_EVENT =
1
CTRL_LOGOFF_EVENT =
5
CTRL_SHUTDOWN_EVENT =
6
ENABLE_PROCESSED_INPUT =
0x0001
ENABLE_LINE_INPUT =
0x0002
ENABLE_WRAP_AT_EOL_OUTPUT =
0x0002
ENABLE_ECHO_INPUT =
0x0004
ENABLE_WINDOW_INPUT =
0x0008
ENABLE_MOUSE_INPUT =
0x0010
ENABLE_INSERT_MODE =
0x0020
ENABLE_QUICK_EDIT_MODE =
0x0040
STD_INPUT_HANDLE =
-10
STD_OUTPUT_HANDLE =
-11
STD_ERROR_HANDLE =
-12
FOREGROUND_BLUE =

Console window constants

0x0001
FOREGROUND_GREEN =
0x0002
FOREGROUND_RED =
0x0004
FOREGROUND_INTENSITY =
0x0008
BACKGROUND_BLUE =
0x0010
BACKGROUND_GREEN =
0x0020
BACKGROUND_RED =
0x0040
BACKGROUND_INTENSITY =
0x0080
COMMON_LVB_LEADING_BYTE =
0x0100
COMMON_LVB_TRAILING_BYTE =
0x0200
COMMON_LVB_GRID_HORIZONTAL =
0x0400
COMMON_LVB_GRID_LVERTICAL =
0x0800
COMMON_LVB_GRID_RVERTICAL =
0x1000
COMMON_LVB_REVERSE_VIDEO =
0x4000
COMMON_LVB_UNDERSCORE =
0x8000
COMMON_LVB_SBCSDBCS =
0x0300
CONSOLE_FULLSCREEN =
1
CONSOLE_OVERSTRIKE =
1
CONSOLE_FULLSCREEN_HARDWARE =
2
AddConsoleAlias =
Win32API.new('kernel32', 'AddConsoleAlias', 'PPP', 'I')
AllocConsole =
Win32API.new('kernel32', 'AllocConsole', 'V', 'I')
CreateConsoleScreenBuffer =
Win32API.new('kernel32', 'CreateConsoleScreenBuffer', 'LLPLP', 'L')
FillConsoleOutputAttribute =
Win32API.new('kernel32', 'FillConsoleOutputAttribute', 'LILLP', 'I')
FillConsoleOutputCharacter =
Win32API.new('kernel32', 'FillConsoleOutputCharacter', 'LILLP', 'I')
FlushConsoleInputBuffer =
Win32API.new('kernel32', 'FlushConsoleInputBuffer', 'L', 'I')
FreeConsole =
Win32API.new('kernel32', 'FreeConsole', 'V', 'I')
GenerateConsoleCtrlEvent =
Win32API.new('kernel32', 'GenerateConsoleCtrlEvent', 'LL', 'I')
GetConsoleAlias =
Win32API.new('kernel32', 'GetConsoleAlias', 'PPLP', 'L')
GetConsoleAliases =
Win32API.new('kernel32', 'GetConsoleAliases', 'PLP', 'L')
GetConsoleAliasesLength =
Win32API.new('kernel32', 'GetConsoleAliasesLength', 'P', 'L')
GetConsoleAliasExes =
Win32API.new('kernel32', 'GetConsoleAliasExes', 'PL', 'L')
GetConsoleAliasExesLength =
Win32API.new('kernel32', 'GetConsoleAliasExesLength', 'V', 'L')
GetConsoleCP =
Win32API.new('kernel32', 'GetConsoleCP', 'V', 'I')
GetConsoleCursorInfo =
Win32API.new('kernel32', 'GetConsoleCursorInfo', 'LP', 'I')
GetConsoleMode =
Win32API.new('kernel32', 'GetConsoleMode', 'LP', 'I')
GetConsoleOutputCP =
Win32API.new('kernel32', 'GetConsoleOutputCP', 'V', 'I')
GetConsoleScreenBufferInfo =
Win32API.new('kernel32', 'GetConsoleScreenBufferInfo', 'LP', 'I')
GetConsoleTitle =
Win32API.new('kernel32', 'GetConsoleTitle', 'PL', 'L')
GetLargestConsoleWindowSize =
Win32API.new('kernel32', 'GetLargestConsoleWindowSize', 'L', 'L')
GetNumberOfConsoleInputEvents =
Win32API.new('kernel32', 'GetNumberOfConsoleInputEvents', 'LP', 'I')
GetNumberOfConsoleMouseButtons =
Win32API.new('kernel32', 'GetNumberOfConsoleMouseButtons', 'L', 'I')
GetStdHandle =
Win32API.new('kernel32', 'GetStdHandle', 'L', 'L')
PeekConsoleInput =
Win32API.new('kernel32', 'PeekConsoleInput', 'LPLP', 'I')
ReadConsole =
Win32API.new('kernel32', 'ReadConsole', 'LPLPP', 'I')
ReadConsoleInput =
Win32API.new('kernel32', 'ReadConsoleInput', 'LPLP', 'I')
ReadConsoleOutput =
Win32API.new('kernel32', 'ReadConsoleOutput', 'LPLLP', 'I')
ReadConsoleOutputAttribute =
Win32API.new('kernel32', 'ReadConsoleOutputAttribute', 'LPLLP', 'I')
ReadConsoleOutputCharacter =
Win32API.new('kernel32', 'ReadConsoleOutputCharacter', 'LPLLP', 'I')
ScrollConsoleScreenBuffer =
Win32API.new('kernel32', 'ScrollConsoleScreenBuffer', 'LPPLP', 'I')
SetConsoleActiveScreenBuffer =
Win32API.new('kernel32', 'SetConsoleActiveScreenBuffer', 'L', 'I')
SetConsoleCommandHistoryMode =
Win32API.new('kernel32', 'SetConsoleCommandHistoryMode', 'L', 'I')
SetConsoleCP =
Win32API.new('kernel32', 'SetConsoleCP', 'L', 'I')
SetConsoleCtrlHandler =
Win32API.new('kernel32', 'SetConsoleCtrlHandler', 'PI', 'I')
SetConsoleCursorInfo =
Win32API.new('kernel32', 'SetConsoleCursorInfo', 'LP', 'I')
SetConsoleCursorPosition =
Win32API.new('kernel32', 'SetConsoleCursorPosition', 'LP', 'I')
SetConsoleMode =
Win32API.new('kernel32', 'SetConsoleMode', 'LL', 'I')
SetConsoleOutputCP =
Win32API.new('kernel32', 'SetConsoleOutputCP', 'I', 'I')
SetConsoleScreenBufferSize =
Win32API.new('kernel32', 'SetConsoleScreenBufferSize', 'LL', 'I')
SetConsoleTextAttribute =
Win32API.new('kernel32', 'SetConsoleTextAttribute', 'LL', 'I')
SetConsoleTitle =
Win32API.new('kernel32', 'SetConsoleTitle', 'P', 'I')
SetConsoleWindowInfo =
Win32API.new('kernel32', 'SetConsoleWindowInfo', 'LIP', 'I')
SetStdHandle =
Win32API.new('kernel32', 'SetStdHandle', 'LL', 'I')
WriteConsole =
Win32API.new('kernel32', 'WriteConsole', 'LPLPP', 'I')
WriteConsoleInput =
Win32API.new('kernel32', 'WriteConsoleInput', 'LPLP', 'I')
WriteConsoleOutput =
Win32API.new('kernel32', 'WriteConsoleOutput', 'LPLLP', 'I')
WriteConsoleOutputAttribute =
Win32API.new('kernel32', 'WriteConsoleOutputAttribute', 'LPLLP', 'I')
WriteConsoleOutputCharacter =
Win32API.new('kernel32', 'WriteConsoleOutputCharacter', 'LPLLP', 'I')

Instance Method Summary collapse

Instance Method Details

#AddConsoleAlias(source, target, exe) ⇒ Object



116
117
118
# File 'lib/windows/console.rb', line 116

def AddConsoleAlias(source, target, exe)
   AddConsoleAlias.call(source, target, exe) != 0
end

#AllocConsoleObject



120
121
122
# File 'lib/windows/console.rb', line 120

def AllocConsole()
   AllocConsole.call != 0
end

#CreateConsoleScreenBuffer(access, mode, sec, flags, data) ⇒ Object



124
125
126
# File 'lib/windows/console.rb', line 124

def CreateConsoleScreenBuffer(access, mode, sec, flags, data)
   CreateConsoleScreenBuffer.call(access, mode, sec, flags, data)
end

#FillConsoleOutputAttribute(handle, attribute, length, coord, num) ⇒ Object



128
129
130
# File 'lib/windows/console.rb', line 128

def FillConsoleOutputAttribute(handle, attribute, length, coord, num)
   FillConsoleOutputAttribute.call(handle, attribute, length, coord, num) != 0
end

#FlushConsoleInputBuffer(handle) ⇒ Object



132
133
134
# File 'lib/windows/console.rb', line 132

def FlushConsoleInputBuffer(handle)
   FlushConsoleInputBuffer.call(handle) != 0
end

#FreeConsoleObject



136
137
138
# File 'lib/windows/console.rb', line 136

def FreeConsole()
   FreeConsole.call != 0
end

#GenerateConsoleCtrlEvent(ctrl_event, process_group_id) ⇒ Object



140
141
142
# File 'lib/windows/console.rb', line 140

def GenerateConsoleCtrlEvent(ctrl_event, process_group_id)
   GenerateConsoleCtrlEvent.call(ctrl_event, process_group_id) != 0
end

#GetConsoleAliases(buffer, buffer_length, exe_name) ⇒ Object



144
145
146
# File 'lib/windows/console.rb', line 144

def GetConsoleAliases(buffer, buffer_length, exe_name)
   GetConsoleAliases.call(buffer, buffer_length, exe_name)
end

#GetConsoleAliasesLength(exe_name) ⇒ Object



148
149
150
# File 'lib/windows/console.rb', line 148

def GetConsoleAliasesLength(exe_name)
   GetConsoleAliasesLength.call(exe_name)
end

#GetConsoleAliasExes(buffer, buffer_length) ⇒ Object



152
153
154
# File 'lib/windows/console.rb', line 152

def GetConsoleAliasExes(buffer, buffer_length)
   GetConsoleAliasExes.call(buffer, buffer_length)
end

#GetConsoleAliasExesLengthObject



156
157
158
# File 'lib/windows/console.rb', line 156

def GetConsoleAliasExesLength()
   GetConsoleAliasExesLength.call
end

#GetConsoleCPObject



160
161
162
# File 'lib/windows/console.rb', line 160

def GetConsoleCP()
   GetConsoleCP.call
end

#GetConsoleCursorInfo(handle, cursor_info_ptr) ⇒ Object



164
165
166
# File 'lib/windows/console.rb', line 164

def GetConsoleCursorInfo(handle, cursor_info_ptr)
   GetConsoleCursorInfo.call(handle, cursor_info_ptr)
end

#GetConsoleMode(handle, mode) ⇒ Object



168
169
170
# File 'lib/windows/console.rb', line 168

def GetConsoleMode(handle, mode)
   GetConsoleMode.call(handle, mode) != 0
end

#GetConsoleOutputCPObject



172
173
174
# File 'lib/windows/console.rb', line 172

def GetConsoleOutputCP()
   GetConsoleOutputCP.call
end

#GetConsoleScreenBufferInfo(handle, buf_info) ⇒ Object



176
177
178
# File 'lib/windows/console.rb', line 176

def GetConsoleScreenBufferInfo(handle, buf_info)
   GetConsoleScreenBufferInfo.call(handle, buf_info) != 0
end

#GetConsoleTitle(title, size) ⇒ Object



180
181
182
# File 'lib/windows/console.rb', line 180

def GetConsoleTitle(title, size)
   GetConsoleTitle.call(title, size)
end

#GetLargestConsoleWindowSize(handle) ⇒ Object



184
185
186
# File 'lib/windows/console.rb', line 184

def GetLargestConsoleWindowSize(handle)
   GetLargestConsoleWindowSize.call(handle)
end

#GetNumberOfConsoleInputEvents(handle, num_events) ⇒ Object



188
189
190
# File 'lib/windows/console.rb', line 188

def GetNumberOfConsoleInputEvents(handle, num_events)
   GetNumberOfConsoleInputEvents.call(handle, num_events)
end

#GetNumberOfConsoleMouseButtons(num_mouse_buttons) ⇒ Object



192
193
194
# File 'lib/windows/console.rb', line 192

def GetNumberOfConsoleMouseButtons(num_mouse_buttons)
   GetNumberOfConsoleMouseButtons.call(num_mouse_buttons)
end

#GetStdHandle(std_handle) ⇒ Object



196
197
198
# File 'lib/windows/console.rb', line 196

def GetStdHandle(std_handle)
   GetStdHandle.call(std_handle)
end

#PeekConsoleInput(handle, buffer, length, num_events) ⇒ Object



200
201
202
# File 'lib/windows/console.rb', line 200

def PeekConsoleInput(handle, buffer, length, num_events)
   PeekConsoleInput.call(handle, buffer, length, num_events) != 0
end

#ReadConsole(handle, buffer, num_to_read, num_read, res = 0) ⇒ Object



204
205
206
# File 'lib/windows/console.rb', line 204

def ReadConsole(handle, buffer, num_to_read, num_read, res = 0)
   ReadConsole.call(handle, buffer, num_to_read, num_read, res) != 0
end

#ReadConsoleInput(handle, buffer, length, num_read) ⇒ Object



208
209
210
# File 'lib/windows/console.rb', line 208

def ReadConsoleInput(handle, buffer, length, num_read)
   ReadConsoleInput.call(handle, buffer, length, num_read) != 0
end

#ReadConsoleOutput(handle, buffer, buf_size, buf_coord, reg) ⇒ Object



212
213
214
# File 'lib/windows/console.rb', line 212

def ReadConsoleOutput(handle, buffer, buf_size, buf_coord, reg)
   ReadConsoleOutput.call(handle, buffer, buf_size, buf_coord, reg) != 0
end

#ReadConsoleOutputAttribute(handle, attrib, len, coord, num_read) ⇒ Object



216
217
218
# File 'lib/windows/console.rb', line 216

def ReadConsoleOutputAttribute(handle, attrib, len, coord, num_read)
   ReadConsoleOutputAttribute.call(handle, attrib, len, coord, num_read) != 0
end

#ReadConsoleOutputCharacter(handle, char, length, coord, num_read) ⇒ Object



220
221
222
# File 'lib/windows/console.rb', line 220

def ReadConsoleOutputCharacter(handle, char, length, coord, num_read)
   ReadConsoleOutputCharacter.call(handle, char, length, coord, num_read) != 0
end

#ScrollConsoleScreenBuffer(handle, scroll, clip, coord, fill) ⇒ Object



224
225
226
# File 'lib/windows/console.rb', line 224

def ScrollConsoleScreenBuffer(handle, scroll, clip, coord, fill)
   ScrollConsoleScreenBuffer.call(handle, scroll, clip, coord, fill) != 0
end

#SetConsoleActiveScreenBuffer(handle) ⇒ Object



228
229
230
# File 'lib/windows/console.rb', line 228

def SetConsoleActiveScreenBuffer(handle)
   SetConsoleActiveScreenBuffer.call(handle) != 0
end

#SetConsoleCommandHistoryMode(flags) ⇒ Object



232
233
234
# File 'lib/windows/console.rb', line 232

def SetConsoleCommandHistoryMode(flags)
   SetConsoleCommandHistoryMode.call(flags) != 0
end

#SetConsoleCP(code_page_id) ⇒ Object



236
237
238
# File 'lib/windows/console.rb', line 236

def SetConsoleCP(code_page_id)
   SetConsoleCP.call(code_page_id) != 0
end

#SetConsoleCtrlHandler(handler, add) ⇒ Object



240
241
242
# File 'lib/windows/console.rb', line 240

def SetConsoleCtrlHandler(handler, add)
   SetConsoleCtrlHandler.call(handler, add) != 0
end

#SetConsoleCursorInfo(handle, cursor) ⇒ Object



244
245
246
# File 'lib/windows/console.rb', line 244

def SetConsoleCursorInfo(handle, cursor)
   SetConsoleCursorInfo.call(handle, cursor) != 0
end

#SetConsoleCursorPosition(handle, coord) ⇒ Object



248
249
250
# File 'lib/windows/console.rb', line 248

def SetConsoleCursorPosition(handle, coord)
   SetConsoleCursorPosition.call(handle, coord) != 0
end

#SetConsoleHistoryInfo(info) ⇒ Object



252
253
254
# File 'lib/windows/console.rb', line 252

def SetConsoleHistoryInfo(info)
   SetConsoleHistoryInfo.call(info) != 0
end

#SetConsoleMode(handle, mode) ⇒ Object



256
257
258
# File 'lib/windows/console.rb', line 256

def SetConsoleMode(handle, mode)
   SetConsoleMode.call(handle, mode) != 0
end

#SetConsoleOutputCP(code_page_id) ⇒ Object



260
261
262
# File 'lib/windows/console.rb', line 260

def SetConsoleOutputCP(code_page_id)
   SetConsoleOutputCP.call(code_page_id) != 0
end

#SetConsoleScreenBufferSize(handle, size) ⇒ Object



264
265
266
# File 'lib/windows/console.rb', line 264

def SetConsoleScreenBufferSize(handle, size)
   SetConsoleScreenBufferSize.call(handle, size) != 0
end

#SetConsoleTextAttribute(handle, attribute) ⇒ Object



268
269
270
# File 'lib/windows/console.rb', line 268

def SetConsoleTextAttribute(handle, attribute)
   SetConsoleTextAttribute.call(handle, attribute) != 0
end

#SetConsoleTitle(title) ⇒ Object



272
273
274
# File 'lib/windows/console.rb', line 272

def SetConsoleTitle(title)
   SetConsoleTitle.call(title) != 0
end

#SetConsoleWindowInfo(handle, absolute, window) ⇒ Object



276
277
278
# File 'lib/windows/console.rb', line 276

def SetConsoleWindowInfo(handle, absolute, window)
   SetConsoleWindowInfo.call(handle, absolute, window) != 0
end

#SetStdHandle(std_handle, handle) ⇒ Object



280
281
282
# File 'lib/windows/console.rb', line 280

def SetStdHandle(std_handle, handle)
   SetStdHandle.call(std_handle, handle) != 0
end

#WriteConsole(handle, buffer, num_to_write, num_written, res = 0) ⇒ Object



284
285
286
# File 'lib/windows/console.rb', line 284

def WriteConsole(handle, buffer, num_to_write, num_written, res = 0)
   WriteConsole.call(handle, buffer, num_to_write, num_written, res) != 0
end

#WriteConsoleInput(handle, buffer, length, num_events) ⇒ Object



288
289
290
# File 'lib/windows/console.rb', line 288

def WriteConsoleInput(handle, buffer, length, num_events)
   WriteConsoleInput.call(handle, buffer, length, num_events) != 0
end

#WriteConsoleOutput(handle, buffer, buf_size, coord, region) ⇒ Object



292
293
294
# File 'lib/windows/console.rb', line 292

def WriteConsoleOutput(handle, buffer, buf_size, coord, region)
   WriteConsoleOutput.call(handle, buffer, buf_size, coord, region) != 0
end

#WriteConsoleOutputAttribute(handle, attrib, length, coord, num) ⇒ Object



296
297
298
# File 'lib/windows/console.rb', line 296

def WriteConsoleOutputAttribute(handle, attrib, length, coord, num)
   WriteConsoleOutputAttribute.call(handle, attrib, length, coord, num) != 0
end

#WriteConsoleOutputCharacter(handle, char, length, coord, num) ⇒ Object



300
301
302
# File 'lib/windows/console.rb', line 300

def WriteConsoleOutputCharacter(handle, char, length, coord, num)
   WriteConsoleOutputCharacter.call(handle, char, length, coord, num) != 0
end