LEADTOOLS Raster Imaging C++ Class Library Help > Classes and Member Functions > LScreenCapture > LScreenCapture Member Functions > LScreenCapture::CaptureFromEXE |
#include "ltwrappr.h"
virtual L_INT LScreenCapture::CaptureFromEXE(pszFileName, nResType, pResID, bCaptureByIndex, clrBackGnd=RGB(0,0,0))
L_TCHAR * pszFileName; |
/* filename to capture from */ |
L_INT nResType; |
/* resource type to capture */ |
L_TCHAR * pResID; |
/* Resource ID to be captured */ |
L_BOOL bCaptureByIndex; |
/* flag that indicates whether pResID is an index or a resource ID */ |
COLORREF clrBackGnd; |
/* background color to be used for icons */ |
Captures an image from the specified resource, stored in an EXE or DLL, into the associated class object's bitmap.
Parameter |
Description |
|
pszFileName |
Character string containing the name of the exe (or dll) from which the resource should be captured. |
|
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 |
pResID |
Specifies the index of the resource to capture. You can use MAKEINDEX or MAKERESOURCEID macros to convert the resource ids to strings. |
|
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. |
clrBackGnd |
Background color for icons. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
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; }