simple-winapi-wrapper 3.0.0

dotnet add package simple-winapi-wrapper --version 3.0.0
NuGet\Install-Package simple-winapi-wrapper -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="simple-winapi-wrapper" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add simple-winapi-wrapper --version 3.0.0
#r "nuget: simple-winapi-wrapper, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install simple-winapi-wrapper as a Cake Addin
#addin nuget:?package=simple-winapi-wrapper&version=3.0.0

// Install simple-winapi-wrapper as a Cake Tool
#tool nuget:?package=simple-winapi-wrapper&version=3.0.0

Simple WinAPI Wrapper

Simple Windows API wrapper class for simulating mouse movement, clicking, window manipulation and more...

Fork from:

WinAPI-Wrapper https://github.com/LazoCoder/WinAPI-Wrapper

Nuget available:

Install-Package simple-winapi-wrapper

Example

System.Diagnostics.Process.Start("notepad");
System.Threading.Thread.Sleep(2000);

var windows = WindowSearch.GetAllWindowsByProcess("notepad", false);

foreach (var window in windows)
{
    Console.WriteLine($"{window.GetTitle()} - {window.GetClass()}");
}

var mainWindow = windows.FirstOrDefault(x => x.GetClass().ToLower() == "notepad");

mainWindow.Maximize();
mainWindow.SetFocused();

Keyboard.Type("hello, hello, hello how are you", 5);
Console.ReadLine();

API

The following is a summary of some of the methods that are available. There are more methods and classes than what is listed below but the purpose is to give a rough idea of what the wrapper can do. To see more details on what a particular methods does and what the parameters are, please take a look at the code itself as it is well commented.

Mouse.cs

public static void LeftClick();
public static void RightClick();
public static void MiddleClick();

public static void LeftDown();
public static void LeftUp();

public static void RightDown();
public static void RightUp();

public static void MiddleDown();
public static void MiddleUp();

public static void Move(int x, int y);
public static void LeftDrag(Point point1, Point point2, int interval, int lag);

Window.cs

public static bool DoesExist(string windowTitle);
public static IntPtr Get(string windowTitle);

public static IntPtr GetFocused();
public static void SetFocused(IntPtr hWnd);
public static bool IsFocused(IntPtr hWnd);

public static void Move(IntPtr hWnd, int x, int y);
public static void Resize(IntPtr hWnd, int width, int height);
public static void Hide(IntPtr hWnd);
public static void Show(IntPtr hWnd);

public static Rectangle GetDimensions(IntPtr hWnd);
public static Size GetSize(IntPtr hWnd);
public static Point GetLocation(IntPtr hWnd);
public static string GetTitle(IntPtr hWnd);
public static void SetTitle(IntPtr hWnd, string title);

public static void Maximize(IntPtr hWnd);
public static void Minimize(IntPtr hWnd);
public static void Normalize(IntPtr hWnd);

public static Bitmap Screenshot(IntPtr hWnd);

public static void RemoveMenu(IntPtr hWnd);
public static void Close(IntPtr hWnd);

public static void DisableCloseButton(IntPtr hWnd);
public static void DisableMaximizeButton(IntPtr hWnd);
public static void DisableMinimizeButton(IntPtr hWnd);

public static void EnableMouseTransparency(IntPtr hWnd);
public static Point ConvertToWindowCoordinates(IntPtr hWnd, int x, int y);
public static Point GetCoordinateRelativeToWindow(IntPtr hWnd);

Desktop.cs

public static Bitmap Screenshot();
public static void HideTaskBar();
public static void ShowTaskBar();
public static int GetWidth();
public static int GetHeight();
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5.2

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 207 4/27/2023
2.0.0 147 4/27/2023
1.0.0 144 4/27/2023

V3.0 Added extensions methods