Interface to the Windows Console functions for dealing with character-mode applications
-
Creates a new console handle
-
Returns the current console's display mode
-
Attaches calling process to console of another process
-
Creates a new console for the calling process
-
Detaches process from its console
-
Returns pids of all processes attached to current console
-
Returns the input code page for calling process's console
-
Returns the output code page for calling process's console
-
Sets the input code page for calling process's console
-
Sets the output code page for calling process's console
-
Returns info on text selection within the current console
-
Creates a new console alias
-
Retrieves aliases defined under specified executable
-
Lists all executables that have console aliases defined
-
Returns a handle to the console's window, or 0 if none exists
-
Returns the number of fonts available to the console
-
Sets the title of calling process's console
-
Returns the title of console to which calling process is attached
-
Sends a control signal to a group of processes attached to a common console
-
Returns one of calling process's standard handles
win32console.AddConsoleAlias
AddConsoleAlias(Source, Target, ExeName) Creates a new console alias
-
Source : PyUNICODE
The string to be mapped to the target string
-
Target : PyUNICODE
String to be substituted for Source. If None, alias is removed
-
ExeName : PyUNICODE
Name of executable that will use alias
win32console.AllocConsole
AllocConsole() Creates a new console for the calling process
Calling process must not already be attached to another console
win32console.AttachConsole
AttachConsole(ProcessId) Attaches to console of another process
-
ProcessId : int
Pid of another process, or ATTACH_PARENT_PROCESS
Calling process must not already be attached to another console
win32console.CreateConsoleScreenBuffer
PyConsoleScreenBuffer = CreateConsoleScreenBuffer(DesiredAccess, ShareMode
, SecurityAttributes
, Flags
) Creates a new console screen buffer
-
DesiredAccess=GENERIC_READ and GENERIC_WRITE : int
GENERIC_READ and/or GENERIC_WRITE
-
ShareMode=FILE_SHARE_READ and FILE_SHARE_WRITE : int
FILE_SHARE_READ and/or FILE_SHARE_WRITE
-
SecurityAttributes=None : PySECURITY_ATTRIBUTES
Specifies security descriptor and inheritance for handle
-
Flags=CONSOLE_TEXTMODE_BUFFER : int
CONSOLE_TEXTMODE_BUFFER is currently only valid flag
win32console.FreeConsole
FreeConsole() Detaches process from its current console
win32console.GenerateConsoleCtrlEvent
GenerateConsoleCtrlEvent(CtrlEvent, ProcessGroupId) Sends a control signal to a group of processes attached to a common console
-
CtrlEvent : int
Signal to be sent to specified process group - CTRL_C_EVENT or CTRL_BREAK_EVENT
-
ProcessGroupId=0 : int
Pid of a process group, use 0 for calling process
win32console.GetConsoleAliasExes
PyUNICODE = GetConsoleAliasExes() Lists all executables that have console aliases defined
Returns a unicode string containing executable names separated by NULLS
win32console.GetConsoleAliases
PyUNICODE = GetConsoleAliases(ExeName) Retrieves aliases defined under specified executable
-
ExeName : PyUNICODE
Name of executable for which to return aliases
Returns a unicode string containing null-terminated pairs of aliases and their target text
of the form "alias1=replacementtext1\\0alias2=replacementtext2\\0"
win32console.GetConsoleCP
int = GetConsoleCP() Returns the input code page for calling process's console
win32console.GetConsoleDisplayMode
int = GetConsoleDisplayMode() Returns the current console's display mode
Only exists on Wix XP and later
CONSOLE_FULLSCREEN,CONSOLE_FULLSCREEN_HARDWARE
win32console.GetConsoleOutputCP
int = GetConsoleOutputCP() Returns the output code page for calling process's console
win32console.GetConsoleProcessList
(int,...) = GetConsoleProcessList() Returns pids of all processes attached to current console
win32console.GetConsoleSelectionInfo
dict = GetConsoleSelectionInfo() Returns info on text selection within the current console
Returns a dictionary containing {Flags:int, SelectionAnchor: PyCOORD, Selection:PySMALL_RECT}
Flags will contain a combination of
CONSOLE_NO_SELECTION,CONSOLE_SELECTION_IN_PROGRESS,CONSOLE_SELECTION_NOT_EMPTY,CONSOLE_MOUSE_SELECTION,CONSOLE_MOUSE_DOWN
win32console.GetConsoleTitle
PyUNICODE = GetConsoleTitle() Returns the title of the console window
win32console.GetConsoleWindow
int = GetConsoleWindow() Returns a handle to the console's window, or 0 if none exists
This function may raise NotImplementedError if it does not exist on
the platform, or a PyHANDLE object with a value of 0. It will never
raise a win32 exception.
win32console.GetNumberOfConsoleFonts
int = GetNumberOfConsoleFonts() Returns the number of fonts available to the console
Function is not documented in MSDN
win32console.GetStdHandle
PyConsoleScreenBuffer = GetStdHandle(StdHandle) Returns one of calling process's standard handles
-
StdHandle : int
Specifies the handle to return - STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE
Returns a PyConsoleScreenBuffer wrapping the handle, or None if specified handle does not exist
win32console.SetConsoleCP
SetConsoleCP(CodePageId) Sets the input code page for calling process's console
-
CodePageId : int
The code page to set
win32console.SetConsoleOutputCP
SetConsoleOutputCP(CodePageID) Sets the output code page for calling process's console
-
CodePageID : int
The code page to set
win32console.SetConsoleTitle
SetConsoleTitle(ConsoleTitle) Sets the title of the console window
-
ConsoleTitle : PyUNICODE
New title for the console