L_AnnGetMetafile

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnGetMetafile(hObject, phMetafile)

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

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; 
   HMETAFILE   Metafile; 
   L_INT       nRet; 
   L_TCHAR*    pszType; 
   L_BOOL      bRetrieve; 
   L_TCHAR     szMsg[200]; 
 
   L_AnnGetType(hObject, &Type); 
   pszType = TEXT(""); 
   bRetrieve = FALSE; 
   switch(Type) 
   { 
   case ANNOBJECT_STAMP: 
      pszType = TEXT("ANNOBJECT_STAMP"); 
      bRetrieve = TRUE; 
      break; 
 
   case ANNOBJECT_HOTSPOT: 
      pszType = TEXT("ANNOBJECT_HOTSPOT"); 
      bRetrieve = TRUE; 
      break; 
 
   case ANNOBJECT_FREEHANDHOTSPOT: 
      pszType = TEXT("ANNOBJECT_FREEHANDHOTSPOT"); 
      bRetrieve = TRUE; 
      break; 
   } 
 
   if (bRetrieve) 
   { 
      nRet = L_AnnGetMetafile(hObject, &Metafile); 
      if (nRet == SUCCESS)  
      { 
         if (Metafile != NULL) 
            wsprintf(szMsg, TEXT("%s Metafile retrieved"), pszType); 
         else 
            wsprintf(szMsg, TEXT("%s Metafile is NULL"), pszType); 
      } 
      else 
      { 
         wsprintf(szMsg, TEXT("%s Error Getting Metafile"), pszType); 
      } 
   } 
   else 
      wsprintf(szMsg, TEXT("Not a stamp and not a freehand object")); 
 
   MessageBox(NULL, szMsg, TEXT(""), MB_OK); 
   return SUCCESS; 
} 
 
L_INT AnnGetMetafileExample(HANNOBJECT      hContainer) 
{ 
   L_INT nRet; 
   nRet = L_AnnEnumerate(hContainer, annMetaCallback, NULL, ANNFLAG_RECURSE|ANNFLAG_NOTCONTAINER, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

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

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