Probably the simplest way is to check for the presence of the OpenGL and DirectX core libraries, probably also a good idea to add in the driver OGL dlls in too (such as nvogl), this can be done via EnumProcesses
& EnumProcessModulesEx
, using p/invoke, this will at least give you a starting set of processes possibly using OGL or DX.
Of course some applications load both of the API's and use only one, or only conditionally use
one of the GFX API's (though the latter only occurs with specialized tools and the like), for this, IMO, the best way to check is to perform some form of injection
or attaching to the process like a debugger would, then hooking either Present
for DX or wglSwapBuffers
for OGL.
You might be about to get away with not using a hook by enumerating the GDI handles and looking for the DXGI or OGL render contexts, how viable this is, I don't know.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…