public class Windows
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Windows.Handle
Defines a wrapper for a HANDLE to hide the Windows definition details
|
static class |
Windows.MsgId
Defines a wrapper for the MsgId to hide Windows definition details.
|
static class |
Windows.Pointer
Defines a wrapper for a Pointer to hide the JNA definition details
|
static class |
Windows.Robot
The Windows.Robot class is a subclass of the java.awt.Robot class.
|
Modifier and Type | Field and Description |
---|---|
static int |
ERROR_FILE_NOT_FOUND |
static int |
m_lastError |
Constructor and Description |
---|
Windows() |
Modifier and Type | Method and Description |
---|---|
static void |
closeHandle(Windows.Handle h)
Closes a previously opened Handle
|
static int |
getLastError()
Returns the last error number to compare against the Error Codes defined above.
|
static java.lang.String |
getLastErrorMessage()
Returns the text error message associated with the last error number.
|
static void |
keyPress(com.sun.jna.platform.win32.WinDef.HWND hWin,
int key) |
static Windows.Pointer |
mapViewOfFile(Windows.Handle h)
Returns a Pointer to the memory where the file was mapped to.
|
static Windows.Handle |
openCommPort(int portNumber)
|
static Windows.Handle |
openEvent(java.lang.String eventName)
Returns a Handle to an Event.
|
static Windows.Handle |
openFileMapping(java.lang.String filename)
Returns a Handle to a memory mapped file.
|
static void |
postMessage(com.sun.jna.platform.win32.WinDef.HWND hWin,
Windows.MsgId id,
int wParam,
int lParam)
Sends a message to the specified window and does not wait on it to be received
|
static Windows.MsgId |
registerWindowMessage(java.lang.String name)
Returns the MsgId of named message.
|
static void |
sendNotifyMessage(Windows.MsgId id,
int wParam,
int lParam)
Sends a message to anyone listening to the specified MsgId
|
static void |
setAffinity(int cores_to_reserve)
Tells windows what cores I'm allowed to run on.
|
static boolean |
setCommPortDTR(Windows.Handle hCommPort,
boolean flag)
This method either sets or clears the DTR signal on the comm port.
|
static boolean |
setCommPortRTS(Windows.Handle hCommPort,
boolean flag)
This method either sets or clears the RTS signal on the comm port.
|
static void |
setConsoleTitle(java.lang.String title)
Sets the title of the console window.
|
static boolean |
setForegroundWindow(java.lang.String windowClass,
java.lang.String windowTitle)
Finds the window with the given title and brings it to the foreground.
|
static void |
unmapViewOfFile(Windows.Pointer p)
Removes the memory pointer mapping.
|
static void |
waitForSingleObject(Windows.Handle h,
int timeout)
Waits for a specified amount of time for an event to occur.
|
public static int ERROR_FILE_NOT_FOUND
public static int m_lastError
public static void closeHandle(Windows.Handle h)
h
- The handle to closepublic static int getLastError()
public static java.lang.String getLastErrorMessage()
public static void keyPress(com.sun.jna.platform.win32.WinDef.HWND hWin, int key)
public static Windows.Pointer mapViewOfFile(Windows.Handle h)
h
- A Handle to a memory mapped file.public static Windows.Handle openCommPort(int portNumber)
portNumber
- The port number to open as an integerpublic static Windows.Handle openEvent(java.lang.String eventName)
eventName
- The name of the event.public static Windows.Handle openFileMapping(java.lang.String filename)
filename
- The memory map name.public static void postMessage(com.sun.jna.platform.win32.WinDef.HWND hWin, Windows.MsgId id, int wParam, int lParam)
hWin
- A handle to an existing window.id
- The MsgId to send to.wParam
- A 32 bit word.lParam
- A 64 bit word.public static Windows.MsgId registerWindowMessage(java.lang.String name)
name
- The name of the messagepublic static void sendNotifyMessage(Windows.MsgId id, int wParam, int lParam)
id
- The MsgId to send to.wParam
- A 32 bit word.lParam
- A 64 bit word.public static boolean setCommPortRTS(Windows.Handle hCommPort, boolean flag)
hCommPort
- A handle to an open comm portflag
- true sets RTS, false clears RTSpublic static boolean setCommPortDTR(Windows.Handle hCommPort, boolean flag)
hCommPort
- A handle to an open comm portflag
- true sets DTR, false clears DTRpublic static void setConsoleTitle(java.lang.String title)
title
- The title.public static boolean setForegroundWindow(java.lang.String windowClass, java.lang.String windowTitle)
windowClass
- The window class or nullwindowTitle
- The window title or nullpublic static void unmapViewOfFile(Windows.Pointer p)
p
- The Pointer to release.public static void waitForSingleObject(Windows.Handle h, int timeout)
h
- A Handle to an event.timeout
- Amount of time to wait in milliseconds.public static void setAffinity(int cores_to_reserve)
cores_to_reserve
- The number of cores to reserve.