downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

imageinterlace> <imagegrabscreen
[edit] Last updated: Fri, 03 May 2013

view this page in

imagegrabwindow

(PHP 5 >= 5.2.2)

imagegrabwindowCapturar una ventana

Descripción

resource imagegrabwindow ( int $window_handle [, int $client_area = 0 ] )

Captura una ventana o su área de cliente usando un gestor de ventanas (la propiedad HWND en instancia COM)

Parámetros

window_handle

El ID del HWND de ventana.

client_area

Incluye el área del cliente de la ventana de aplicación.

Valores devueltos

Devuelve un identificador de recurso de imagen si tiene éxito, FALSE si falló.

Errores/Excepciones

E_NOTICE es emitido si window_handle no es un gestor de ventana válido. E_WARNING es emitido si la API de Windows es demasiado antigua.

Ejemplos

Ejemplo #1 Ejemplo de imagegrabwindow()

Capturar una ventana (IE por ejemplo)

<?php
$navegador 
= new COM("InternetExplorer.Application");
$gestor $navegador->HWND;
$navegador->Visible true;
$im imagegrabwindow($gestor);
$navegador->Quit();
imagepng($im"iesnap.png");
imagedestroy($im);
?>

Capturar una ventana (IE por ejemplo) pero con su contenido

<?php
$navegador 
= new COM("InternetExplorer.Application");
$gestor $navegador->HWND;
$navegador->Visible true;
$navegador->Navigate("http://www.libgd.org");

/* ¿Todavía funciona? */
while ($navegador->Busy) {
    
com_message_pump(4000);
}
$im imagegrabwindow($gestor0);
$navegador->Quit();
imagepng($im"iesnap.png");
imagedestroy($im);
?>

Notas

Nota:

Esta función sólo está disponible en Windows.

Ver también



add a note add a note User Contributed Notes imagegrabwindow - [2 notes]
up
0
Xeon
5 years ago
This function was painfully slow when I was testing it on my machine. It took about 2 or 3 seconds for it to return an image. It also fails to work if the Apache service doesn't have access to "Interact with the desktop".
up
0
nico ->atdot
5 years ago
If you just want to take a screenshot of a website WITHOUT the ugly IE window around it, the easiest way is setting the "Fullscreen" property to TRUE.

$browser->Fullscreen = true;

This is basically the same as pressing F11 once the browser is open, so you just get the actual website.

 
show source | credits | sitemap | contact | advertising | mirror sites