How do I get the current FPS of an application through C++?

Noah Thompson 5 Reputation points
2025-05-03T04:07:22.0366667+00:00

Hello!

I'm thinking about creating an application which would display the current framerate. I would like to find out if there's a way I can query the FPS a game is running at. It's definitely possible, as apps such as Xbox Game Bar can display the FPS of a game. But I can't find any information on any APIs that are available that expose this information. Is there any API in Win32 that offers this data? Or at the very least, the FPS of the currently focused window?

Thank you!

Noah

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,761 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 88,871 Reputation points
    2025-05-03T08:13:32.71+00:00

    With ETW, like : https://github.com/GameTechDev/PresentMon

    (or by hooking IDXGISwapChain::Present with a DLL, more complicated. I had done it with MS Detours a long time ago, but can be done with other API Hooking Libraries, like MinHook, EasyHook,...)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.