Top Description Inners Fields Methods
com.sun.jna.platform.win32

public Interface Wincon

Known Direct Subinterfaces
com.sun.jna.platform.win32.Kernel32
Imports
com.sun.jna.Native, .Structure, .Structure.FieldOrder, .Union, com.sun.jna.platform.win32.WinDef.HWND, .WinDef.LPVOID, .WinNT.HANDLE, com.sun.jna.ptr.IntByReference

Ported from Wincon.h.
Author
lgoldstein

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Wincon.CONSOLE_SCREEN_BUFFER_INFO

CONSOLE_SCREEN_BUFFER_INFO structure

public static class
Wincon.COORD

COORD structure

public static class
Wincon.INPUT_RECORD

INPUT_RECORD structure

public static class
Wincon.KEY_EVENT_RECORD

KEY_EVENT_RECORD structure

public static class
Wincon.MOUSE_EVENT_RECORD

MOUSE_EVENT_RECORD structure

public static class
Wincon.SMALL_RECT

SMALL_RECT structure

public static class
Wincon.WINDOW_BUFFER_SIZE_RECORD

WINDOW_BUFFER_SIZE_RECORD structure

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
AllocConsole
()

Allocates a new console for the calling process.

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
AttachConsole
(int
The identifier of the process whose console is to be used. Can be either the process ID or the special ATTACH_PARENT_PROCESS value to indicate the console of the parent of the current process.
dwProcessId
)

Attaches the calling process to the console of the specified process

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
FlushConsoleInputBuffer
(WinNT.HANDLE
A handle to the console input buffer. The handle must have the GENERIC_WRITE access right.
hConsoleInput
)

Flushes the console input buffer.

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
FreeConsole
()

Detaches the calling process from its console

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GenerateConsoleCtrlEvent
(int
The type of signal to be generated.
dwCtrlEvent
,
int
The identifier of the process group to receive the signal
dwProcessGroupId
)

Sends a specified signal to a console process group that shares the console associated with the calling process.

public int

Returns:

Code that identifies the code page
GetConsoleCP
()

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GetConsoleDisplayMode
(IntByReference
The display mode of the console
lpModeFlags
)

Retrieves the display mode of the current console

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GetConsoleMode
(WinNT.HANDLE
A handle to the console input buffer or the console screen buffer. The handle must have the GENERIC_READ access right
hConsoleHandle
,
IntByReference
A pointer to a variable that receives the current mode of the specified buffer
lpMode
)

public int

Returns:

If the function succeeds, the return value is the length of the string copied to the buffer, in characters. If the buffer is not large enough to store the title, the return value is zero and GetLastError returns ERROR_SUCCESS. If the function fails, the return value is zero and GetLastError returns the error code.
GetConsoleOriginalTitle
(char[]
A pointer to a buffer that receives a null-terminated string containing the original title

Note

use Native#toString(char[]) to convert it to a String value

lpConsoleTitle
,
int
The size of the lpConsoleTitle buffer, in characters
nSize
)

public int

Returns:

Retrieves the output code page used by the console associated with the calling process.
GetConsoleOutputCP
()

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GetConsoleScreenBufferInfo
(WinNT.HANDLE
A handle to the console screen buffer.
hConsoleOutput
,
Wincon.CONSOLE_SCREEN_BUFFER_INFO
A pointer to a CONSOLE_SCREEN_BUFFER_INFO structure that receives the console screen buffer information.
lpConsoleScreenBufferInfo
)

Retrieves information about the specified console screen buffer.

public int

Returns:

If the function succeeds, the return value is the length of the console window's title, in characters. If the function fails, the return value is zero and GetLastError returns the error code.
GetConsoleTitle
(char[]
A pointer to a buffer that receives a null-terminated string containing the title. If the buffer is too small to store the title, the function stores as many characters of the title as will fit in the buffer, ending with a null terminator

Note

use Native#toString(char[]) to convert it to a String value

lpConsoleTitle
,
int
The size of the buffer pointed to by the lpConsoleTitle parameter, in characters.
nSize
)

public WinDef.HWND

Returns:

The window handle used by the console associated with the calling process
GetConsoleWindow
()

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GetNumberOfConsoleInputEvents
(WinNT.HANDLE
A handle to the console input buffer. The handle must have the GENERIC_READ access right
hConsoleInput
,
IntByReference
A pointer to a variable that receives the number of unread input records in the console's input buffer
lpcNumberOfEvents
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
GetNumberOfConsoleMouseButtons
(IntByReference
A pointer to a variable that receives the number of mouse buttons
lpNumberOfMouseButtons
)

public WinNT.HANDLE

Returns:

A handle to the specified standard device (standard input, output, or error)
GetStdHandle
(int
The standard device identifier
nStdHandle
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
ReadConsoleInput
(WinNT.HANDLE
A handle to the console input buffer.
hConsoleInput
,
Wincon.INPUT_RECORD[]
A pointer to an array of INPUT_RECORD structures that receives the input buffer data.
lpBuffer
,
int
The size of the array pointed to by the lpBuffer parameter, in array elements.
nLength
,
IntByReference
A pointer to a variable that receives the number of input records read.
lpNumberOfEventsRead
)

Reads data from a console input buffer and removes it from the buffer.

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
SetConsoleCP
(int
The identifier of the code page to be set
wCodePageID
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
SetConsoleMode
(WinNT.HANDLE
A handle to the console input buffer or a console screen buffer. The handle must have the GENERIC_READ access right
hConsoleHandle
,
int
The input or output mode mask to be set
dwMode
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
SetConsoleOutputCP
(int
The output code page used by the console associated with the calling process.
wCodePageID
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
SetConsoleTitle
(String
The string to be displayed in the title bar of the console window. The total size must be less than MAX_CONSOLE_TITLE_LENGTH.
lpConsoleTitle
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
SetStdHandle
(int
The standard device identifier
nStdHandle
,
WinNT.HANDLE
The handle for the standard device
hHandle
)

public boolean

Returns:

true if successful - if false then use GetLastError() to get extended error information
WriteConsole
(WinNT.HANDLE
A handle to the console screen buffer.
hConsoleOutput
,
String
A pointer to a buffer that contains characters to be written to the console screen buffer.
lpBuffer
,
int
The number of characters to be written.
nNumberOfCharsToWrite
,
IntByReference
A pointer to a variable that receives the number of characters actually written.
lpNumberOfCharsWritten
,
WinDef.LPVOID
Reserved; must be NULL.
lpReserved
)

Writes a character string to a console screen buffer beginning at the current cursor location.