Manuel PHP

imagegrabwindow

(PHP 5 >= 5.2.2)

imagegrabwindow — Captures a window

Description

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

Grabs a window or its client area using a windows handle (HWND property in COM instance)

Liste de paramètres

window

The HWND window ID

client_area

Include the client area of the application window

Valeurs de retour

Returns an image resource identifier on success, FALSE on failure.

Erreurs / Exceptions

E_NOTICE is issued if window_handle is invalid window handle. E_WARNING is issued if the Windows API is too old.

Exemples

Example#1 imagegrabwindow() example

Capture a window (IE for example)

  1. <?php
  2. $browser = new COM("InternetExplorer.Application");  
  3. $handle = $browser->HWND;  
  4. $browser->Visible = true;  
  5. $im = imagegrabwindow($handle);  
  6. $browser->Quit();  
  7. imagepng($im, "iesnap.png");  
  8. ?> 

Capture a window (IE for example) but with its content

  1. <?php
  2. $browser = new COM("InternetExplorer.Application");  
  3. $handle = $browser->HWND;  
  4. $browser->Visible = true;  
  5. $browser->Navigate("http://www.libgd.org");  
  6.  
  7. /* Still working? */  
  8. while ($browser->Busy) { 
  9.    com_message_pump(4000);  
  10. }  
  11. $im = imagegrabwindow($handle, 0);  
  12. $browser->Quit();  
  13. imagepng($im, "iesnap.png");  
  14. ?> 

Notes

Note: This function is only available on Windows.

Voir aussi


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Breizh Blog