virtual L_INT LScreenCapture::CaptureFromEXE(pszFileName, nResType, pResID, bCaptureByIndex, clrBackGnd=RGB(0,0,0))
Captures an image from the specified resource, stored in an EXE or DLL, into the associated class object's bitmap.
Character string containing the name of the exe (or dll) from which the resource should be captured.
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 |
Specifies the index of the resource to capture. You can use MAKEINDEX or MAKERESOURCEID macros to convert the resource ids to strings.
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. |
Background color for icons.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document