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

search for in the

imageinterlace> <imagegrabscreen
Last updated: Fri, 10 Oct 2008

view this page in

imagegrabwindow

(PHP 5 >= 5.2.2)

imagegrabwindowCapture une fenêtre

Description

resource imagegrabwindow ( int $window [, int $client_area ] )

Capture une fenêtre ou l'espace de son client, en utilisant un gestionnaire de fenêtre (propriété HWND de l'instance COM).

Liste de paramètres

window

L'identifiant HWND de la fenêtre.

client_area

Inclure ou non l'espace du client de la fenêtre de l'application.

Valeurs de retour

Retourne une ressource image en cas de succès, ou FALSE si une erreur survient.

Erreurs / Exceptions

Une alerte de type E_NOTICE est émise si window_handle est un gestionnaire de fenêtre invalide. Une alerte de type E_WARNING est émise si l'API Windows est trop ancienne.

Exemples

Exemple #1 Exemple avec imagegrabwindow()

Capture une fenêtre (IE par exemple).

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

Capture une fenêtre (IE par exemple) mais avec son contenu.

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

/* Fonctionne toujours ? */
while ($browser->Busy) {
    
com_message_pump(4000);
}
$im imagegrabwindow($handle0);
$browser->Quit();
imagepng($im"iesnap.png");
?>

Notes

Note: Cette fonction n'est disponible que sous Windows.

Voir aussi



add a note add a note User Contributed Notes
imagegrabwindow
Xeon
30-Sep-2007 05:01
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".
nico ->atdot
29-Sep-2007 05:37
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.

imageinterlace> <imagegrabscreen
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites