What would be the cleanest method for determining if the active foreground window is using direct3d.
I know I can check if it has d3d modules loaded, but that alone doesn't confirm without a shadow of a doubt that it is rendering with direct3d.
I could scan the memory to see if instances of the classes have been initialized, but that takes up too much CPU and time.
The solution has to be very fast and very low on resource usage so that it can be used once per second to determine if my own application needs to close to free up resources for people to play their games.
Hooking into games (injecting DLLs) can have very bad consequences for gamers… as in they can get banned. Anti-cheating programs check for such unknown DLLs.
What you need to do is detect when your window is minimized and free up resources or at least pause rendering. When it comes back up, continue business as usual.
Or just teach your users to close the app while playing, like everyone does. A smart gamer plays games with everything non-game required closed.