Takes a screenshot of an OpenInsight window and saves it to a bitmap file.
Syntax
SRP_Save_Screenshot(CtrlEntId, OutputFile, ClientOnly) |
Title Field | Description |
---|---|
CtrlEntId | The full qualified name of the window whose screenshot is to be saved. |
OutputFile | The full path and filename into which the screenshot is to be saved. |
ClientOnly | A flag indicating whether or not the screenshot includes the whole window or just the client area. |
The SRP_Save_Screenshot method saves the screenshot of a window to a bitmap file. This function is useful for automating the printing of screenshots in a corporate environment. In fact, the method was developed for a client whose employees frequently sent screenshots to each other via email and hard copy.
The CtrlEntId parameter identifies the window of which the screenshot is to be taken. SRP_Save_Screenshot was developed sepcifically to take screenshots of whole windows. While nothing prevents you from specifying a control, SRP_Save_Screenshot has not been stress tested for such uses.
The OutputFile parameter identifies the destination file to which the screenshot is to be saved. SRP_Save_Screenshot only saves in the BMP format regardless of the file extension specified. This parameter can be a relative or full path, and you should be sure to have write privileges to the desired destination.
The ClientOnly parameter is an optional flag indicating whether or not the non-client area of the window (the caption and edges) are included in the screenshot. Omitting this parameter or setting it to 0 includes the non-client window, and you get something like this:
Setting this parameter to 1 excludes the non-client area, and you get something like this:
As a fun example, I created a simple window with an SRP Picture Control and a button. When the button is clicked, I take screenshot of the window and place it into the picture control. The code executed when hitting the button is simple:
// The destination file File = "TestScreenshot.bmp" // Take the screenshot SRP_Save_Screenshot(@Window, File) // Load it into the SRP Picture Control Set_Property(@Window:".OLE_PICTURE", "OLE.Image", File) |
Here is a screenshot of my window after clicking the button ten times: