Example code for PHP Imagegrabscreen and Imagegrabwindow (intercepting site thumbnails) _php Tutorial

Source: Internet
Author: User
1. Capture the entire screen screenshot
Copy CodeThe code is as follows:
$im = Imagegrabscreen ();
Imagepng ($im, "myscreenshot.png");
?>

2. Capturing a window capture a Windows (IE for example)
Copy CodeThe code is as follows:
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$im = Imagegrabwindow ($handle);
$browser->quit ();
Imagepng ($im, "iesnap.png");
$im = Imagegrabscreen ();
?>

3. Capturing IE content capture a window(IE for example) but with its content!
Copy CodeThe code is as follows:
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$browser->navigate ("http://www.jb51.net");

/* Still working? */
while ($browser->busy) {
Com_message_pump (4000);
}
$im = Imagegrabwindow ($handle, 0);
$browser->quit ();
Imagepng ($im, "iesnap.png");
?>

4. Capturing IE's full-screen modeIE in fullscreen mode
Copy CodeThe code is as follows:
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;

$browser->visible = true;
$browser->fullscreen = true;
$browser->navigate ("http://www.jb51.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");
?>

Above that is how to use the PHP com call IE window to open the Web page to screen, but many friends get the result is only a pure black picture, this is why?
There may be two cases, the first case is that this COM component only applies to Windows Server, the other system server is not supported, because he does not have Internet Explorer, the second case is not open allow services to interact with the desktop! The second is the most common, and the way to open it is to click on the computer (My Computer), right----services and applications----Apache (I use Apache server myself)--right--property-&G T Login, login status below both!

http://www.bkjia.com/PHPjc/825074.html www.bkjia.com true http://www.bkjia.com/PHPjc/825074.html techarticle 1. Capture the entire screen screenshot copy code code as follows: PHP $im = Imagegrabscreen (); Imagepng ($im, "myscreenshot.png"); 2. Capturing a window capture a Windows (IE for ex ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.