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.
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
- .NET 9.0 SDK or later
- Windows OS (uses Windows-specific APIs)
dotnet build ActivityTracker/ActivityTracker.csprojdotnet run --project ActivityTracker/ActivityTracker.csproj- Run the application
- Click on any window on your screen
- View the captured information in the console
- Press
Ctrl+Cto exit
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 |
- 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
| 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 |
Tracker/
├── ActivityTracker/
│ ├── Program.cs # Main entry point and core logic
│ └── ActivityTracker.csproj
├── LICENSE
├── README.md
└── Tracker.slnx # Solution file
This project is licensed under the MIT License — see the LICENSE file for details.