Signals that the user has pressed the capture HotKey.
#include "ltwrappr.h"
virtual L_INT LScreenCapture::CaptureHotKeyCallBack(nHotKey, uHotKeyModifiers)
Key code for activation key.
Modifier keys used with nHotKey. Possible values are listed below and may be combined using the bitwise OR ( | ) operator.
Value | Meaning |
---|---|
MOD_ALT | Alt Key pressed. |
MOD_CONTROL | Control key pressed. |
MOD_SHIFT | Shift key pressed. |
0 | No modifier key was pressed. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
You can override this function to do initialization processing before the capture operation starts.
Win32, x64.
// ScreenCapture Callbacks
class LUserScreenCapture : public LScreenCapture
{
HWND m_hWnd;
public:
LUserScreenCapture(HWND hWnd){m_hWnd = hWnd;}
virtual ~LUserScreenCapture(){};
virtual L_INT CaptureHotKeyCallBack(L_INT nHotKey,L_UINT uHotKeyModifiers);
virtual L_INT ScreenCaptureCallBack();
};
// This callback will be called once the hotkey is pressed
L_INT LUserScreenCapture::CaptureHotKeyCallBack(L_INT nHotKey,L_UINT uHotKeyModifiers)
{
UNREFERENCED_PARAMETER(nHotKey);
UNREFERENCED_PARAMETER(uHotKeyModifiers);
MessageBox(m_hWnd, TEXT("HotKey pressed."), TEXT("CaptureHotKeyCallBack"), MB_OK);
return SUCCESS;
}
// This callback will be called once an image is captured
L_INT LUserScreenCapture::ScreenCaptureCallBack()
{
RECT rcClientRect;
HDC hDC;
hDC = GetDC(m_hWnd);
// get the client rect of the window
GetClientRect(m_hWnd, &rcClientRect);
// paint the captured image
m_pBitmap->Paint()->SetDC(hDC);
m_pBitmap->SetDstRect(&rcClientRect);
m_pBitmap->Paint()->PaintDC();
ReleaseDC(m_hWnd, hDC);
return SUCCESS;
}
L_INT LScreenCapture__CaptureHotKeyCallBackExample(HWND hWnd)
{
L_INT nRet;
LBitmapBase LeadBitmap;
LUserScreenCapture screenCapture(hWnd);
LEADCAPTUREOPTION CaptureOptions;
screenCapture.SetBitmap(&LeadBitmap);
// get original capture options
nRet = screenCapture.GetCaptureOptions(&CaptureOptions);
if(nRet == SUCCESS)
{
// Set capture count to 2
CaptureOptions.uCount = 2;
nRet = screenCapture.SetCaptureOptions(&CaptureOptions);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
// EnableCallBack should be called in order for the callbacks to be activated
screenCapture.EnableCallBack(TRUE);
// CaptureActiveWindow - HotKey = F11
// After calling this function above callbacks will be called
nRet = screenCapture.CaptureActiveWindow();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document