LScreenCapture::CaptureFromEXEDlg

#include "ltwrappr.h"

virtual L_INT LScreenCapture::CaptureFromEXEDlg(pszFileName, pTransparentColor, nResType, uFlags, nDialogType=LTCAPDLG_TREEVIEW)

L_TCHAR L_FAR * pszFileName;

/* filename to capture from */

COLORREF L_FAR * pTransparentColor;

/* pointer to a color */

L_INT nResType;

/* resource type to be captured */

L_UINT uFlags;

/* flags to determine function behavior */

L_INT nDialogType;

/* type of dialog to be displayed */

Displays a dialog and captures an image from a 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.

pTransparentColor

Pointer to a color to be used in place of the transparent color of an Icon or Cursor.

nResType

Type of resource to be captured. Possible values are:

Value

Meaning

RESTYPE_BITMAP

capture a bitmap

RESTYPE_ICON

capture an icon

RESTYPE_CURSOR

capture a cursor

uFlags

Flags that specify the function behavior. Possible values are:

 

Value

Meaning

 

0

Ignore this flag. Pass this if you do not wish to use this flag.

 

SCRDLG_CAPTUREFROMEXE_CONTEXTHELP

[0x0008] Show the context help button.

nDialogType

Type of dialog to be displayed. Possible values are:

Value

Meaning

CAP_DLG_TREEVIEW

Display tree dialog

CAP_DLG_TABVIEW

Display tab view

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

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, LScreenCapture::ScreenCaptureHelpCallBack

Topics:

Using Color Values in LEADTOOLS

Example

L_VOID MyFunction(HWND hWnd)
{
   L_INT nRet;
   HDC hDC;
   RECT rcDestRect;
   COLORREF Transparent;
   LBitmap LeadBitmap;
   LScreenCapture screenCapture(&LeadBitmap);

   // CaptureFromExeDlg
   //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.CaptureFromEXEDlg(TEXT("MFCDEM32.EXE"), &Transparent, 0, RESTYPE_BITMAP);
   if(nRet == SUCCESS)
   {
      hDC = GetDC(hWnd);
      LeadBitmap.Paint()->SetDC(hDC);
      SetRect(&rcDestRect, 0, 0, LeadBitmap.GetWidth(), LeadBitmap.GetHeight());
      LeadBitmap.SetDstRect(&rcDestRect);
      LeadBitmap.Paint()->PaintDC();
      ReleaseDC(hWnd, hDC);
   }
   return;
}