Article ID: 142319
Article Last Modified on 2/22/2007
int CALLBACK EnumEnhMetafileProc( HDC hDC,
HANDLETABLE *lpHTable,
ENHMETARECORD *lpEMFR,
int nObj, LPARAM lpData )
{
DWORD dwIndex;
HGDIOBJ hObj;
// Which record type is this record?
switch( lpEMFR->iType )
{
case EMR_SELECTOBJECT: // It's a SelectObject() record
// Is the high order bit set?
if( lpEMFR->dParm[0] & 0x80000000 )
{
// High order bit is set - its a stock object
// Strip the high bit to get the index
dwIndex = lpEMFR->dParm[0] & 0x7fffffff;
// Pass the index to GetStockObject()
hObj = GetStockObject( dwIndex );
// Select the object into the DC
SelectObject( hDC, hObj );
}
else
{
// High order bit wasn't set - not a stock object
SelectObject( hDC,
lpHTable->objectHandle[lpEMFR->dParm[0]] );
}
break;
default:
// Process other records
PlayEnhMetaFileRecord( hDC, lpHTable, lpEMFR, nObj );
break;
}
// Return non-zero to continue enumeration
return 1;
}
Note that this information is important only if the application needs to
decipher the record. Simply passing the EMR_SELECTOBJECT record to
PlayEnhMetaFileRecord() is valid independent of whether or not the object of interest is a stock object.
Additional query words: Windows 95 4.00 3.50 Enumerate EnumEnhMetaFile EnhMetaFileProc missing EMR_CREATEBRUSHINDIRECT
Keywords: kbhowto KB142319