Original article can be found here on The Pimp. Alternatively you can use third party thumbnail generators API, but your app will be dependent which you will not want.


$im = imagegrabscreen();
imagepng($im, "myscreenshot.png");

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

$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://blog.thepimp.net");

/* Still working? */
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");

$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;

$browser->Visible = true;
$browser->FullScreen = true;
$browser->Navigate("http://blog.thepimp.net");

/* Is it completely loaded? (be aware of frames!)*/
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
?>

It should work with any kind of window as long as you give the correct handle (usually $obj->HWND).