L_AnnGetMetafile

Summary

Retrieves the metafile handle associated with a stamp object (including the Rubber Stamp tools), encrypt object, hotspot object, or freehand hotspot object.

Syntax

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnGetMetafile(hObject, phMetafile)

Parameters

HANNOBJECT hObject

Handle to the annotation object.

HMETAFILE *phMetafile

Pointer to a variable to be updated with the handle to a metafile.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If this function is successful, the address pointed to by phMetafile will be updated with the metafile handle.

The Stamp object (which includes the Rubber Stamp tools) can display text, a bitmap or a metafile. Only one of these three can be displayed at any timesetting the object to one of these destroys any settings for the other two.

Initially, the Stamp object displays text. The difference between the Stamp and the Rubber Stamp is that initially whereas the Stamp does not display an image, the Rubber Stamp tools are set to display different metafiles (one for each rubber stamp selection).

Initially, the Hotspot, Freehand Hotspot, and Encrypt objects are also set to display predefined metafiles.

Call the L_AnnGetMetafile function to retrieve a metafile for an object. Call the L_AnnSetMetafile function to change the metafile for an object. Any new objects will still get the default metafile.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example enumerates through all of the annotations in a container and retrieves the metafiles for the stamp, hotspot, and freehand hotspot objects.

L_INT EXT_CALLBACK annMetaCallback(HANNOBJECT hObject, L_VOID* pUserData) 
{ 
   UNREFERENCED_PARAMETER(pUserData); 
 
   L_UINT      Type; 
   L_HMETAFILE Metafile; 
   L_INT       nRet = SUCCESS; 
   L_TCHAR*    pszType = TEXT(""); 
   L_BOOL      bRetrieve = L_FALSE; 
   L_TCHAR     szMsg[200]; 
 
   nRet = L_AnnGetType(hObject, &Type); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   switch (Type) 
   { 
   case ANNOBJECT_STAMP: 
      pszType = TEXT("ANNOBJECT_STAMP"); 
      bRetrieve = L_TRUE; 
      break; 
 
   case ANNOBJECT_HOTSPOT: 
      pszType = TEXT("ANNOBJECT_HOTSPOT"); 
      bRetrieve = L_TRUE; 
      break; 
 
   case ANNOBJECT_FREEHANDHOTSPOT: 
      pszType = TEXT("ANNOBJECT_FREEHANDHOTSPOT"); 
      bRetrieve = L_TRUE; 
      break; 
   } 
 
   if (!bRetrieve) 
   { 
      _tprintf(_T("%s"), TEXT("Not a stamp, hotspot or freehand hotspot object.")); 
      return FAILURE; 
   } 
 
   nRet = L_AnnGetMetafile(hObject, &Metafile); 
   if (nRet != SUCCESS) 
   { 
      wsprintf(szMsg, TEXT("%s Error Getting Metafile"), pszType); 
      _tprintf(_T("%s"), szMsg); 
      return nRet; 
   } 
 
   if (Metafile != NULL) 
      wsprintf(szMsg, TEXT("%s Metafile retrieved"), pszType); 
   else 
      wsprintf(szMsg, TEXT("%s Metafile is NULL"), pszType); 
 
   _tprintf(_T("%s"), szMsg); 
   return nRet; 
} 
 
extern "C" L_INT AnnGetMetafileExample(HANNOBJECT hContainer) 
{ 
   return L_AnnEnumerate(hContainer, annMetaCallback, NULL, ANNFLAG_RECURSE | ANNFLAG_NOTCONTAINER, NULL); 
} 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.