NGMemory is a Windows-only .NET Framework library for external process memory access, basic debugging, GUI automation, screen analysis, and lightweight overlays.
- Read and write memory in external processes
- Scan process memory for byte patterns with wildcard support
- Wait for hardware breakpoints and inspect CPU registers
- Automate classic Win32 controls such as buttons, text boxes, combo boxes, check boxes, and list views
- Simulate keyboard and mouse input
- Capture screenshots, search colors, and compare images
- Apply Windows screen-capture protection to top-level windows
- Attach transparent overlay forms to target windows
- Wait for conditions, windows, controls, processes, signals, and action results with timeout and cancellation
- Windows
- .NET Framework 4.7.2
- A desktop application target (Win32/WinForms style controls are the main focus)
- Sufficient process permissions for memory and debug operations
dotnet build NGMemory.slnReference the generated DLL from:
NGMemory\bin\Debug\NGMemory.dll
NGMemory\bin\Release\NGMemory.dll
using NGMemory;
using NGMemory.Easy;
using NGMemory.Waiting;
using NGMemory.Overlay;
using NGMemory.WinInteropTools;NGMemory/NGMemory: core interop, scanner, debug hook, constants, enums, structuresNGMemory/VAMemory: generic typed memory read/write wrapperNGMemory/WinInteropTools: low-level control and window interop helpersNGMemory/Easy: higher-level convenience APINGMemory/Waiting: detailed synchronous/asynchronous waiting and action workflowsNGMemory/Overlay: overlay manager, configuration, and style helpers
Full documentation with focused examples is available in docs/index.md.
using NGMemory;
var memory = new VAMemory("notepad");
if (memory.CheckProcess())
{
int value = memory.ReadInt32((IntPtr)0x12345678);
memory.WriteInt32((IntPtr)0x12345678, value + 1);
}using System;
using System.Diagnostics;
using NGMemory;
var process = Process.GetProcessesByName("notepad")[0];
var scanner = new Scanner(process);
IntPtr? address = scanner.ScanMemory("90 90 ?? 90");using NGMemory.Easy;
IntPtr hwnd = EasyWindow.FindAndFocus("notepad");
EasyKeyboard.TypeText("Automation started");using NGMemory.Easy;
IntPtr hwnd = EasyWait.ForWindow("notepad", timeout: 10000);
if (hwnd != IntPtr.Zero)
{
bool completed = EasyWait.DoAndWait(
() => EasyButton.Click(hwnd, 1),
() => EasyTextBox.GetText(hwnd, 1001) == "Saved",
timeout: 3000);
}Use NGMemory.Waiting.Waiter when you need a detailed result with timeout, cancellation, elapsed time, attempts, and the last error. Complete examples are in docs/waiting.md.
using NGMemory.Easy;
var result = EasyWindow.SetCaptureProtection(hwnd, true);
if (!result.ReturnValue)
{
Console.WriteLine("SetWindowDisplayAffinity failed: " + result.Win32Error);
}SetWindowDisplayAffinity only works for top-level windows owned by the current process. Normal controls cannot be protected individually; use separate borderless top-level overlay windows for selected protected regions. WDA_EXCLUDEFROMCAPTURE is correctly supported starting with Windows 10 version 2004.
using NGMemory.CaptureProtection;
var maskControl = new CaptureMaskControl();
maskControl.BindToOwner(this);
controlsPanel.Controls.Add(maskControl);CaptureMaskControl is a designer-editable WinForms control. It creates a movable top-level protected area, supports click-through border mode, WDA_MONITOR black capture masking, and visible demo modes for placeholder text or simulated blur. Placeholder and blur are intentionally visible demo modes because screenshot-only text/blur for arbitrary foreign windows is not provided by normal Win32 APIs.
using NGMemory.Easy;
EasyTextBox.SetText(hwnd, 1001, "Hello");
EasyButton.Click(hwnd, 1);
bool isChecked = EasyCheckBox.IsChecked(hwnd, 2001);using System;
using System.Drawing;
using NGMemory.Easy;
using NGMemory.Overlay;
IntPtr hwnd = EasyWindow.GetMainWindow("notepad");
if (hwnd != IntPtr.Zero)
{
var manager = new OverlayManager();
manager.CreateOverlay(hwnd, overlay =>
{
overlay.Configure()
.WithSize(220, 80)
.WithPosition(OverlayPosition.BottomRight)
.WithOffset(12, 12)
.WithBackgroundColor(Color.Transparent)
.WithLabel("Overlay active", 10, 10, Color.LimeGreen)
.WithButton("Click", 10, 35, 90, 28, (s, e) => { });
});
}High-level helper classes for common automation tasks.
EasyButton: click a button by window handle and control idEasyCheckBox: read, set, toggle, or click check boxesEasyComboBox: read items and select entriesEasyDebugHook: wait for register values on hardware breakpointsEasyElementFinder: find child controls by class name, text, or control idEasyFormHelper: batch operations for text boxes, combo boxes, and check boxesEasyGuiInterop: get window handles, child windows, titles, class names, and control handlesEasyKeyboard: type text and send common shortcutsEasyMemory: process lookup, pattern search, and string readsEasyMouse: move, click, double-click, and dragEasyOverlay: overlay form attached to another windowEasyPressKey: low-level key pressing helpers based on scan codesEasyScreen: capture screen, region, or window and search for a colorEasyScreenAnalysis: find all color matches, compare images, and search template imagesEasySysListView32: read and interact withSysListView32controlsEasyTextBox: get, set, or clear text box contentEasyWait: conditions, windows, controls, processes, signals, actions, async waits, and retriesEasyWindow: find, focus, inspect windows, and apply screen-capture protection
Overlay-specific components.
OverlayManager: create, track, remove, and auto-scan overlays for windowsOverlayConfiguration: fluent configuration for size, position, controls, colors, and callbacksOverlayStyleHelper: Alt-Tab visibility helpers for overlay windowsTargetWindowType: filter matching windows by MDI, dialog, normal, or all windowsOverlayPosition:TopLeft,TopRight,BottomLeft,BottomRight,Center
CaptureMaskControl: designer-editable WinForms UI for a protected areaProtectedAreaManager: create, move, resize, bind, and remove a protected areaProtectedAreaWindow: borderless draggable top-level protected area windowCaptureMaskViewModel: reusable state object for position, size, visual mode, and affinity resultCaptureMaskProtectionHelper: applies the right display affinity for mask modes
Lower-level wrappers around Win32 messaging and control access.
GuiInteropHandler: find dialog items, enumerate process windows, and inspect window titles/classesCheckBox,ComboBox,TextBox: direct wrappers for common controlsInputHelper: keyboard and mouse input usingSendInputMenuStripHelper: click menu entries by index pathSysListView32: read list view items from other processesWindowStyleHelper: parent/style/position helpers for windows
Scanner: scans readable memory regions of a target processDebugHook: attaches as debugger, sets a hardware breakpoint, and returns register valuesModule: reads a module base address from a processVAMemory: typed memory read/write convenience wrapperConstants,Enums,Structures,Kernel32,User32,MessageHelper: Win32 interop definitions and helper methods
Waiter: cancellable polling, Windows/process/signal waits, action completion, and retriesWaitOptions: timeout, poll interval, and transient error behaviorWaitResult/WaitResult<T>: structured outcome and diagnosticsWindowQuery: precise process, title, state, and custom window matching
- This library targets classic Windows desktop applications. It is not intended for browser automation or modern UI frameworks that do not expose standard Win32 controls.
- Memory scanning, writing, and debugging may require elevated permissions depending on the target process.
- Overlay functionality depends on a message loop, so it is primarily intended for WinForms-style applications.
- Some helper methods interact with controls by sending messages directly; behavior can vary if a target application uses owner-drawn or custom controls.
MIT