LScreenCapture::CaptureFromEXEDlg

#include "ltwrappr.h"

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

L_TCHAR * pszFileName;

/* filename to capture from */

COLORREF * 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 determine the options dialog. Possible values are:

 

Value

Meaning

 

NONE

[0x0000] No "?" help button will be shown.

 

SCRDLG_CAPTUREFROMEXE_CONTEXTHELP

[0x0008] Capture from exe options dialog context help.

 

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_INT LScreenCapture__CaptureFromEXEDlgExample(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());
      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;
}