PHP 5 >= 5.2.2, PHP 7, PHP 8
imagegrabwindow - Captures a window
Code Examples

imagegrabwindow( int$handle, [bool$client_area = false] ): GdImage|false

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


This function is only available on Windows.



The HWND window ID.


Include the client area of the application window.

Return Values

Returns an image object on success, false on failure.

Exceptions and Errors

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


Version Description
8.0.0 On success, this function returns a GDImage instance now; previously, a resource was returned.
8.0.0 client_area expects a bool now; previously it expected an int.

Related Functions

Example of imagegrabwindow

Show all examples for imagegrabwindow

PHP Version:

Function imagegrabwindow:

Image Processing and GD Functions

Most used PHP functions