Dumb searches: EnumWindowProc eats CPU

I normally don’t do these types of post on this blog. I assume the searcher arrived here because of this post where I called that API function years ago…

Well well… You are enumerating all the Windows on the machine and wondering why it eats the CPU… Why not just read the MSDN documentation for the function – you’re probably doing something stupid. Once you get that right, why not call the API from a thread? And if you call it forever in an endless loop, it is expected to use 100% CPU. That said, you shouldn’t normally need to call this function. More than likely you’re doing so to solve some other problem, and you’ve assumed this is the way to go. It isn’t.


About Jerome

I am a senior C# developer in Johannesburg, South Africa. I am also a recovering addict, who spent nearly eight years using methamphetamine. I write on my recovery blog about my lessons learned and sometimes give advice to others who have made similar mistakes, often from my viewpoint as an atheist, and I also write some C# programming articles on my programming blog.
This entry was posted in Programming and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s