English |
Русский
A collection of Java utilities for interacting with Windows via native DLLs.
- Native interactions: Direct access to Windows API via Java wrappers
- Input control: Precise mouse manipulation (clicks, cursor positioning)
- Keyboard control: Press individual keys and intercept global keyboard events
- System notifications: Windows toast notifications delivery
- Console operations: Color-formatted output
- System operations: Shutdown/reboot + low-level functions
- Message boxes: Alert, confirm, and prompt dialogs via native Windows dialogs
- Static API: Utility classes with instantiation prevention
- Native integration: Optimized pre-built DLL components
// Simple alert dialog
WinMessageBox.alert("This is an alert message", "Alert", "OK");
// Confirmation dialog with two buttons
int result = WinMessageBox.confirm("Do you want to continue?", "Confirm", new String[]{"Yes", "No"});
if (result == 0) {
// First button clicked
} else {
// Second button clicked or dialog closed
}
// Prompt dialog with input field
String input = WinMessageBox.prompt("Enter your name:", "Prompt", "Default Name", new String[]{"OK", "Cancel"});
if (!input.isEmpty()) {
// First button clicked with input
} else {
// Second button clicked or dialog closed
}// Left click
WinMouse.leftClick();
// Right click
WinMouse.rightClick();
// Set cursor position (X, Y)
WinMouse.setCursorPosition(100, 200);
// Get current position
Position pos = WinMouse.getCursorPosition();// Send notification
WinNotifications.send("Message text", "Title");// System shutdown
WinSystem.shutdown();
// System reboot
WinSystem.reboot();
// Trigger BSoD
// Dangerous operation, use with caution!
// Requires enabling via WinTools.setDangerOpsEnabled(true)
try {
WinSystem.bsod();
} catch (SecurityException e) {
// Throws if dangerous operations are disabled
}// Basic output
WinTerminal.write("Text without newline");
WinTerminal.writeLine("Text with newline");
// Colored output
WinTerminal.write("Red text", Colors.RED);
WinTerminal.writeLine("Blue text", Colors.BLUE);
// Reset color
WinTerminal.resetColor();
// Set persistent color
WinTerminal.setColor(Colors.GREEN);// OS check
if (WinTools.isWindows()) {
// Windows-specific logic
}
// Enable/disable dangerous operations
WinTools.setDangerOpsEnabled(false);
// Check dangerous operations status
boolean enabled = WinTools.isDangerOpsEnabled();// Add a global keyboard listener
WinKeyboard.addListener(vkCode -> {
System.out.println("Key Pressed! VK Code: " + vkCode);
// Example: Check for INSERT key (VK 45)
if (vkCode == 45) {
System.out.println("INSERT pressed");
}
});
// Remove the listener when no longer needed
// WinKeyboard.removeListener(myListener);
// Virtual key code for 'A' = 0x41
// Press 'A'
WinKeyboard.pressKeyDown(0x41);
// Release 'A'
WinKeyboard.pressKeyUp(0x41);
// Press and release 'A'
WinKeyboard.pressKey(0x41);- Add the JitPack repository to your
pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>- Add the dependency
<dependency>
<groupId>com.github.KvaytG</groupId>
<artifactId>win-tools</artifactId>
<version>-SNAPSHOT</version>
</dependency>Optional: to use a specific version, tag a release and replace -SNAPSHOT with the tag name.
- Tested only on Windows 10 and Windows 11.
- Administrator privileges are NOT required.
- Dangerous operations are disabled by default and require explicit enabling.
- Functions marked with
@Dangerousare intended only for:- Security research
- System stability testing
- Educational purposes
Special thanks to adasdead for developing the original native DLL, which made the project possible.
Licensed under the PolyForm Noncommercial license.
This project uses open-source components. For license details see pom.xml and dependencies' official websites.