LScreenCapture::CaptureFromEXE

Summary

Captures an image from the specified resource, stored in an EXE or DLL, into the associated class object's bitmap.

Syntax

#include "ltwrappr.h"

virtual L_INT LScreenCapture::CaptureFromEXE(pszFileName, nResType, pResID, bCaptureByIndex, clrBackGnd=RGB(0,0,0))

Parameters

L_TCHAR * pszFileName

Character string containing the name of the exe (or dll) from which the resource should be captured.

L_INT nResType

Specifies the type of resource to capture. Possible values are:

Value Meaning
RESTYPE_BITMAP capture a bitmap resource
RESTYPE_ICON capture an icon resource
RESTYPE_CURSOR capture a cursor resource

L_TCHAR * pResID

Specifies the index of the resource to capture. You can use MAKEINDEX or MAKERESOURCEID macros to convert the resource ids to strings.

L_BOOL bCaptureByIndex

Flag that indicates whether pResID represents an index or a resource ID. Possible values are:

Value Meaning
TRUE pResID is the index position of the requested resource.
FALSE pResID is the resource ID of the requested resource.

COLORREF clrBackGnd

Background color for icons.

Returns

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

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LScreenCapture__CaptureFromEXEExample(HWND hWnd) 
{ 
   L_INT nRet; 
   HDC hDC; 
   RECT rcDestRect; 
   LBitmap LeadBitmap; 
   LScreenCapture screenCapture(&LeadBitmap); 
 
   // CaptureFromExe  
   //MFCDEM32 is shipped with LEADTOOLS, you have to copy it to the directory of the sample 
   // it has an ICON with ID=128 
   nRet = screenCapture.CaptureFromEXE(TEXT("MFCDEM32.EXE"), RESTYPE_ICON, MAKEINTRESOURCE(128), 0); 
 
   //   COLORREF Transparent; 
   if(nRet == SUCCESS) 
   { 
      hDC = GetDC(hWnd); 
 
      LeadBitmap.Paint()->SetDC(hDC); 
 
      // Set destination rectangle to be the same as the bitmap dimensions 
      SetRect(&rcDestRect, 0, 0, LeadBitmap.GetWidth(), LeadBitmap.GetHeight()); 
 
      nRet = LeadBitmap.SetDstRect(&rcDestRect); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      nRet = LeadBitmap.Paint()->PaintDC(); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      ReleaseDC(hWnd, hDC); 
   } 
   else 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.