LScreenCapture::CaptureFromEXE
#include "ltwrappr.h"
virtual L_INT LScreenCapture::CaptureFromEXE(pszFileName, nResType, pResID, bCaptureByIndex, clrBackGnd=RGB(0,0,0))
/* filename to capture from */ | |
L_INT nResType; |
/* resource type to capture */ |
/* 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. |
See Also
Functions: |
|
Topics: |
Example
L_VOID MyFunction(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());
LeadBitmap.SetDstRect(&rcDestRect);
LeadBitmap.Paint()->PaintDC();
ReleaseDC(hWnd, hDC);
}
return;
}