Holas :).
Hay alguna forma de sacar un screenshot de un juego en win vista/7 ?.
Con gui sale negra o el escritorio.Estuve biendo con DirectX pero lei que es muy lento y si la img esta en movimiento sale mal :S.
Hay alguna otra forma ?,opengl ?.
gracias :D.
@EDIT
Tambien lei que configurando algunas cosas en la compatibilidad del juego .exe se puede hacer que funcione con gui.Hay alguna forma de configurar eso desde otra aplicacion ?.
deshabilitando la aceleración de hardware en dxdiag.
tenes que llamar a esta API:
http://msdn.microsoft.com/en-us/library/aa969510%28v=vs.85%29.aspx
antes de capturar la pantalla...
bool ManageTheme(bool a){
return (DwmEnableComposition(a?DWM_EC_ENABLECOMPOSITION:DWM_EC_DISABLECOMPOSITION)==S_OK);
}
S2
Muy buen aporte de Karman; si queres que el programa funcione en versiones anteriores de Windows usa enlazado dinamico (LoadLibrary + GetProcAddress).
Gracias a los 2 :D,veo que sale xd.
@EDIT
creo que pude :).pero asta que no instale el msn no voy saber si funciona :S.
#include <windows.h>
#include <winbase.h>
#include <captura.h>
#define DWM_EC_DISABLECOMPOSITION 0
#define DWM_EC_ENABLECOMPOSITION 1
typedef UINT (CALLBACK* DLLFUNC)(UINT);
DLLFUNC DwmEnableComposition;
bool init_dll();
void fix_win_vis_7(bool enable);
bool is_win_vis_7;
int main()
{
if(init_dll()) {
is_win_vis_7 = true;
MessageBox(NULL, "Dwmapi.dll OK", "test", MB_OK | MB_ICONEXCLAMATION);
}
Sleep(5000);
if(is_win_vis_7)
fix_win_vis_7(true);
cap("test.bmp");
if(is_win_vis_7)
fix_win_vis_7(false);
MessageBox(NULL, "Screenshot sacada", "test", MB_OK | MB_ICONEXCLAMATION);
return 0;
}
void fix_win_vis_7(bool enable)
{
DwmEnableComposition(enable?DWM_EC_ENABLECOMPOSITION:DWM_EC_DISABLECOMPOSITION);
}
bool init_dll()
{
HINSTANCE hDLL;
hDLL = LoadLibrary("Dwmapi");
if(hDLL == NULL)
return false;
DwmEnableComposition = (DLLFUNC)GetProcAddress(hDLL, "DwmEnableComposition");
if(!DwmEnableComposition)
{
FreeLibrary(hDLL);
return false;
}
return true;
}
Esta bien ?.