imagegrabwindow() and imagegrabscreen()

I stumbled over these two new functions in the PHP CVS today. They are only available in Windows as they use COM, but interesting non the least.

imagegrabwindow — Captures a window
resource imagegrabwindow ( int $window [, int $client_area] )

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

imagegrabscreen — Captures the whole screen
resource imagegrabscreen ( void )

Grabs a screenshot of the whole screen.

See the manual pages for examples.

Update: Pierre discusses it on his blog aswell.

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

3 thoughts on “imagegrabwindow() and imagegrabscreen()”

  1. Hi!

    The functions do not use COM, only my examples as it is one of the only way to actually control an application on Windows from a standard PHP install 🙂

    The functions use the win32 API to fetch the bitmap of a given window or screen.

Leave a Reply

Your email address will not be published. Required fields are marked *