Share via

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 development | Windows API - Win32
0 comments No comments

1 answer

Sort by: Most helpful
  1. Castorix31 91,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,...)

    Was this answer helpful?

    0 comments No comments

Your answer

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