LScreenCapture::CaptureHotKeyCallBack

#include "ltwrappr.h"

virtual L_INT LScreenCapture::CaptureHotKeyCallBack(nHotKey, uHotKeyModifiers)

L_INT nHotKey;

/* key code for activation key */

L_UINT uHotKeyModifiers;

/* modifier key */

Signals that the user has pressed the capture HotKey.

Parameter

Description

nHotKey

Key code for activation key.

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

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

LTDIS
LTSCR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

Class Members

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;
}