Ver Mensaje Individual
  #9  
Antiguo 05-12-2013
Segator Segator is offline
Registrado
NULL
 
Registrado: nov 2013
Posts: 8
Reputación: 0
Segator Va por buen camino
Thumbs up Solucion final.

Disculpen si los enrede un poco en el post de arriba, pero ya logre capturar cada monitor de forma independiente, gracias a escafandra, hice una simplificacion del codigo y otros pequeños cambios y asi es como quedo:

Código Delphi [-]
function monitortobmp(pantalla:TMonitor);
var 
DC:HDC;
    bmp, hbmp:HBitMap; 
    mw,     mh,     mt,     ml:integer;
    imagen:TBitMap; 
    mirror:boolean;
begin
    mw:=pantalla.Width;
    mh:=pantalla.Height;
    mt:=pantalla.Top;
    ml:=pantalla.Left;
    mirror:=false;
if pantalla.MonitorNum <> 0 then
   begin 
 if mt = 0 then
 begin 
   mirror:=true;
   ShowMessage('El monitor '+inttostr(pantalla.MonitorNum+1)+' no existe o es un espejo');
   end;
 end;
if not mirror then
  begin
    DC:=CreateCompatibleDC(0);
    bmp:=CreateCompatibleBitmap(GetDC(0), mw, mh);
    hbmp:=SelectObject(DC,bmp);
    BitBlt(DC, 0, 0, mw, mh, GetDC(0), ml,mt, SRCCOPY + $40000000);
    SelectObject(DC, hbmp);
    DeleteObject(DC);
    imagen:=TBitMap.Create;
    imagen.Handle:=bmp;
    imagen.SaveToFile('pantalla.bmp');
   {elimine la variable n porque yo aqui en ves de salvar el bmp se lo asigne a un componente visual Imagen
     y luego este lo salvo con un numero incremental}
    imagen.Free;
 end;
end;

luego pueden saber si hay mas de un monitor disponible con:
Código Delphi [-]
screen.MonitorCount;

y llamar a la funcion asi:
Código Delphi [-]
monitortobmp(screen.Monitors[x].Handle);

donde x es el numero del monitor al que quieran capturar
espero les sirva a todos, saludos.

Última edición por ecfisa fecha: 05-12-2013 a las 16:05:22. Razón: Corregir etiquetas [DELPHI] en modo WYSIWYG
Responder Con Cita