ScnLib_SelectCaptureRegion()

ScnLib_SelectCaptureRegionA/W()

Std EditionPro EditionMax EditionUltra Edition
C++ __declspec(dllimport) BOOL __stdcall ScnLib_SelectCaptureRegionA(long *left, long *top, long *right, long *bottom, HWND *pHWND, LPCSTR pcszTip);
__declspec(dllimport) BOOL __stdcall ScnLib_SelectCaptureRegionW(long *left, long *top, long *right, long *bottom, HWND *pHWND, LPCWSTR pcwszTip);
C# [DllImport("ScnLib.dll", CharSet = CharSet.Unicode)] public static extern bool ScnLib_SelectCaptureRegionW(ref int left, ref int top, ref int right, ref int bottom, ref IntPtr Wnd, string Tip);
Basic Public Declare Unicode Function ScnLib_SelectCaptureRegionW Lib "ScnLib.dll" (ByRef left As Int32, ByRef top As Int32, ByRef right As Int32, ByRef bottom As Int32, ByRef Wnd As IntPtr, ByVal Tip As String) As Boolean
Delphi function ScnLib_SelectCaptureRegionA(var left: Integer; var top: Integer; var right: Integer; var bottom: Integer; var Wnd: THandle; const Tip: PAnsiChar): LongBool; stdcall; external 'ScnLib.dll';
function ScnLib_SelectCaptureRegionW(var left: Integer; var top: Integer; var right: Integer; var bottom: Integer; var Wnd: THandle; const Tip: PWideChar): LongBool; stdcall; external 'ScnLib.dll';
  • Description
    Provide the user with a built-in on-screen region selection tool to select a specific window or a region on the screen.

  • Parameters
    • left [out]
      The x-coordinate, in pixels, representing the upper-left corner of the region of selection.
    • top [out]
      The y-coordinate, in pixels, representing the upper-left corner of the region of selection.
    • right [out]
      The x-coordinate, in pixels, representing the lower-right corner of the region of selection.
    • bottom [out]
      The y-coordinate, in pixels, representing the lower-right corner of the region of selection.
    • Wnd [out]
      If the user clicks on a window, the handle of the selected window will be provided. However, if the user selects an arbitrary area on the screen by holding and dragging the left mouse button to form a rectangle, a zero value will be set.
    • Tip [in]
      Display a tip on the corner of the highlight window area to let user be aware that click to select the window under the cursor, or drag the mouse to select a custom region.
    • The region of selection excludes the right and bottom edges of the rectangle.
  • Return Value
    If a window or a region is selected successfully, the return value is TRUE. If user has cancelled the selection, the return value is FALSE.

  • Remarks
    For screen recording, users often prefer to record a specific window or a region. To facilitate this, you can provide an interface enabling easy screen region selection. If you'd rather not develop such an interface, this function can be used to access the SDK's built-in on-screen region selection tool.

    Upon invoking this function, the desktop will dim, and the window under the mouse cursor will be highlighted. To select a window, move the cursor over it and click the left mouse button. For selecting a custom region, position the cursor at the upper-left corner of the desired area, press and hold the left mouse button, drag to the lower-right corner, and release the button to complete the selection. On a multi-monitor system, pressing and holding the CTRL key during the selection process will constrain the selection coordinates to the screen area of the monitor where the mouse cursor is located.

    Selection can be canceled at any time by right-clicking or pressing ESC. A magnifying tool appears on-screen to assist with precise selection. The coordinates of the selected region can be passed to ScnLib_SetCaptureRegion() to set the recording region or to ScnLib_TakeScreenshotA/W() for taking a screenshot. If a window is selected, you may pass its handle to ScnLib_SetCaptureWnd() to bind the capture window.

  • See Also
    ScnLib_SetCaptureWnd()
    ScnLib_SetCaptureRegion()
    ScnLib_GetCaptureRegion()
    ScnLib_ShowCaptureRegionFrame()
    ScnLib_GetCaptureRegionFrameWnd()
    ScnLib_TakeScreenshotA/W()

Try the SDK for FREE SDK APIs overview