<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.imagegrabwindow" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>imagegrabwindow</refname>
  <refpurpose>Captures a window</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>GdImage</type><type>false</type></type><methodname>imagegrabwindow</methodname>
   <methodparam><type>int</type><parameter>handle</parameter></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>client_area</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Grabs a window or its client area using a windows handle (HWND property in COM instance)
  </para>
  <note>
   <para>
    This function is only available on Windows.
   </para>
  </note>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>handle</parameter></term>
     <listitem>
      <para>
       The HWND window ID.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>client_area</parameter></term>
     <listitem>
      <para>
       Include the client area of the application window.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns an image object on success, &false; on failure.
  </para>
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <para>
   E_NOTICE is issued if <parameter>handle</parameter> is invalid
   window handle.
   E_WARNING is issued if the Windows API is too old.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.0.0</entry>
      <entry>
       On success, this function returns a <classname>GDImage</classname> instance now;
       previously, a <type>resource</type> was returned.
      </entry>
     </row>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <parameter>client_area</parameter> expects a <type>bool</type> now;
       previously it expected an <type>int</type>.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>imagegrabwindow</function> example</title>
    <para>
     Capture a window (IE for example)
    </para>
    <programlisting role="php">
<![CDATA[
<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$im = imagegrabwindow($handle);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?>
]]>
    </programlisting>
    <para>
     Capture a window (IE for example) but with its content
    </para>
    <programlisting role="php">
<![CDATA[
<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.libgd.org");

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

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>imagegrabscreen</function></member>
  </simplelist>
 </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
