how to get the cpu usage by window api

Li, Cindy 1 Reputation point
2020-08-18T12:47:17.713+00:00

i want to monitor the windows system cpu usage using c/c++ code
which api can i use and how to get the cpu usage?

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,498 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 82,751 Reputation points
    2020-08-18T13:11:29.31+00:00

    One of the ways is with PDH
    If I test the old MS KB287158 sample,
    by replacing PdhAddCounter by PdhAddEnglishCounter (my OS is french) (+ changing strings to Unicode),
    I get about the same result as Task Manager

    0 comments No comments