GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / CreateGdPictureImageFromHwnd Method / CreateGdPictureImageFromHwnd(Int32) Method
A Window Handle, as Integer value. This must be a top-level window or a child of a top level window.
Example





In This Topic
CreateGdPictureImageFromHwnd(Int32) Method
In This Topic
Creates a new GdPicture image from a window handle HWnd.
Syntax
'Declaration
 
Public Overloads Function CreateGdPictureImageFromHwnd( _
   ByVal HANDLE As Integer _
) As Integer
public int CreateGdPictureImageFromHwnd( 
   int HANDLE
)
public function CreateGdPictureImageFromHwnd( 
    HANDLE: Integer
): Integer; 
public function CreateGdPictureImageFromHwnd( 
   HANDLE : int
) : int;
public: int CreateGdPictureImageFromHwnd( 
   int HANDLE
) 
public:
int CreateGdPictureImageFromHwnd( 
   int HANDLE
) 

Parameters

HANDLE
A Window Handle, as Integer value. This must be a top-level window or a child of a top level window.

Return Value

0: The image could not be created. Use the GetStat() method to determine the reason this method failed. Non-zero: GdPicture image identifier. The created image. The ReleaseGdPictureImage() method must be subsequently used to release the image from the memory.
Remarks
You can get the Windows Desktop hwnd with the GetDesktopHwndI method.
Example
Creating a GdPicture image from a Window handle and saving to a PNG file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromHwnd(gdpictureImaging.GetDesktopHwndI());
    gdpictureImaging.SaveAsPNG(imageID, "image.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also