1.1.0 • Published 3 years ago
windowcpp v1.1.0
WindowCpp
Allow you to handle process from a windows application.
Installation
Use the package manager npm or yarn to install Mouse.
yarn add windowcpp
npm install windowcpp
Usage
Work in both: typescript and javascript.
const Window = require("windowcpp").default;
const processName = "Process Name"
const window = new Window(processName);
// [...]
API
window
Class to handle your process.
Example:
showWindow(nCmdShow).
See the possible values of nCmdShow here.
window.showWindow("SW_SHOWMAXIMIZED");
writeMemoryValue(address, message);
Write the message in the current address. See more here.
window.writeMemoryValue(0xFF0232DD, "12");
getWindowsSize()
Return an object with the height and width of the window.const size = window.getWindowsSize(); console.log(size.height); console.log(size.width);
postMessage(WPARAM);
window.postMessage("VK_F12");
readMemoryValue(address);
const value = window.readMemoryValue(0xFFFFFFFF); console.log(value);
screenshoot(filename);
window.screenshoot("./screenshot.jpg");
setWindowPosition(hWndInsertAfter, movex, movey, width , height);
Change the position and the size of the window. See more here.window.setWindowPosition("HWND_TOPMOST", 200, 200, 800, 400);
setForegroundWindow();
Activate the window and bring to front. See more here.window.setForegroundWindow();
leftClick(x: number, y: number): void;
Press left mouse button in the x and y position.window.leftClick(100,100);
rightClick(x: number, y: number): void;
Press right mouse button in the x and y position.window.leftRight (100,100);
leftAndRightClick(x: number, y: number): void;
Press right and left mouse button in the x and y position.window.leftAndRightClick(100,100);
moveMouse(x: number, y: number);
Move the mouse in the x and y position.window.moveMouse(100,100);
Note
All commands refer to the chosen process.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.