Skip to content

Repository files navigation

ActivityTracker

.NET 9.0 Windows License: MIT

A real-time Windows utility that captures detailed information about windows when you click on them. Perfect for understanding what applications and documents are active on your system.

Features

When you click anywhere on the screen, ActivityTracker captures:

  • Process Name — The application name (e.g., chrome, notepad, devenv)
  • Window Title — The title bar text of the clicked window
  • Executable Path — Full path to the running application's executable
  • Document Path — Detected file path for supported applications (Notepad, VS Code, Word, Excel, PowerPoint)
  • Click Position — X, Y screen coordinates where the click occurred
  • Timestamp — When the click happened

Requirements

  • .NET 9.0 SDK or later
  • Windows OS (uses Windows-specific APIs)

Getting Started

Build

dotnet build ActivityTracker/ActivityTracker.csproj

Run

dotnet run --project ActivityTracker/ActivityTracker.csproj

Usage

  1. Run the application
  2. Click on any window on your screen
  3. View the captured information in the console
  4. Press Ctrl+C to exit

Technical Details

Windows APIs Used

ActivityTracker uses P/Invoke to call native Windows APIs from user32.dll:

API Function Purpose
GetAsyncKeyState Detects mouse button states (left/right click)
WindowFromPoint Gets the window handle at a specific screen coordinate
GetWindowText Retrieves the window's title bar text
GetWindowTextLength Gets the length of the window title
GetWindowThreadProcessId Gets the process ID associated with a window
GetCursorPos Gets the current cursor position
GetForegroundWindow Gets the handle of the currently active window

Architecture

  • Async polling loop — 10ms interval for responsive click detection with minimal CPU usage
  • Edge detection — Tracks button state transitions to detect click events (not continuous button hold)
  • Error handling — Gracefully handles processes that require elevated permissions

Limitations

Limitation Details
Windows-only Uses user32.dll P/Invoke — will not work on macOS/Linux
Elevated permissions Some system processes may require admin privileges to access process information
Document detection Only detects open files for specific apps (Notepad, VS Code, Word, Excel, PowerPoint) via window title parsing

Project Structure

Tracker/
├── ActivityTracker/
│   ├── Program.cs           # Main entry point and core logic
│   └── ActivityTracker.csproj
├── LICENSE
├── README.md
└── Tracker.slnx             # Solution file

License

This project is licensed under the MIT License — see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages