LScreenCapture::CaptureHotKeyCallBack

#include "ltwrappr.h"

virtual L_INT LScreenCapture::CaptureHotKeyCallBack(nHotKey, uHotKeyModifiers)

Signals that the user has pressed the capture HotKey.

Parameters

L_INT nHotKey

Key code for activation key.

L_UINT uHotKeyModifiers

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.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

You can override this function to do initialization processing before the capture operation starts.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Example

// 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 Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.