Forum und email

imagegrabwindow

(PHP 5 >= 5.2.2)

imagegrabwindow — ウィンドウをキャプチャする

説明

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

ウィンドウあるいはそのクライアント領域のキャプチャを、 ウィンドウハンドル (COM インスタンスの HWND プロパティ) を指定して取得します。

パラメータ

window

HWND ウィンドウ ID。

client_area

アプリケーションのクライアント領域を含めるかどうか。

返り値

成功した場合に画像リソースの ID、失敗した場合に FALSE を返します。

エラー / 例外

window_handle が無効なウィンドウハンドルである場合に E_NOTICE、 Windows API のバージョンが古すぎる場合に E_WARNING が発生します。

Example#1 imagegrabwindow() の例

ウィンドウ (ここでは IE) のキャプチャを行います。

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

ウィンドウ (ここでは IE) の中身のキャプチャを行います。

<?php
$browser 
= new COM("InternetExplorer.Application");
$handle $browser->HWND;
$browser->Visible true;
$browser->Navigate("https://www.libgd.org");

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

注意

注意: この関数は Windows 上でしか使用できません。