L_AnnGetMetafile

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnGetMetafile(hObject, phMetafile)

HANNOBJECT hObject;

/* handle to the annotation object */

HMETAFILE *phMetafile;

/*pointer to a variable to be updated with the handle to a metafile */

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

This function is available in the Document and Medical Imaging toolkits.

Parameter

Description

hObject

Handle to the annotation object.

phMetafile

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

Returns

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

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 2000 / XP/Vista.

See Also

Functions:

L_AnnSetMetafile, L_AnnSetPredefinedMetafile, L_AnnGetPredefinedMetafile

Topics:

Annotation Functions: Object Properties

 

Implementing Annotations

 

Automated User Interface for Annotations

 

Implementing an Automated Annotation Program

 

Obtaining Annotation Object Information

 

Using Annotation Bitmap Objects

 

Annotation Functions (Document/Medical only): Getting and Setting the Object Metafile Property

Example

Sample for L_AnnGetMetafile This sample enumerates through all annotations in a container and retrieves the metafile 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;
}