Article ID: 196299 - Last Review: July 11, 2005 - Revision: 1.2

BUG: ExtCreatePen Functionality Unavailable in Enhanced Metafile

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
This article was previously published under Q196299

On This Page

Expand all | Collapse all

SYMPTOMS

When you build an enhanced metafile on Windows 95 or Windows 98, pen creation calls are stored as EMR_CREATEPEN records instead of EMR_EXTCREATEPEN records. This results in a loss of information, which alters the appearance of the image. This problem does not occur on Windows NT.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

If you execute the following code into an enhanced metafile Device Context (DC) and then replay the resulting metafile, the pen strokes do not appear as they were recorded. If, on the other hand, you execute the code into a screen DC, everything appears correctly.

Sample Code

   BOOL TestDrawOnDC( HDC hDC )
   {
      LOGBRUSH   lb;
      int         i;
      int         iEnd[3]  = { PS_ENDCAP_ROUND,
                               PS_ENDCAP_SQUARE,
                               PS_ENDCAP_FLAT },
                  iJoin[3] = { PS_JOIN_BEVEL,
                               PS_JOIN_MITER,
                               PS_JOIN_ROUND };
      HPEN      hPen, hOldPen;

      lb.lbStyle = BS_SOLID ;
      lb.lbColor = RGB (128, 128, 128) ;
      lb.lbHatch = 0 ;

      for( i=0; i<3; i++ )
      {
         hPen = ExtCreatePen( PS_SOLID |
                              PS_GEOMETRIC |
                              iEnd [i] |
                              iJoin [i],
                              10, &lb, 0, NULL );
         hOldPen = SelectObject( hDC, hPen );

         BeginPath( hDC );
         MoveToEx( hDC, 10 +  30 * i, 65, NULL );
         LineTo( hDC, 20 +  30 * i, 75 );
         LineTo( hDC, 30 + 30 * i, 65 );
         EndPath( hDC );
         StrokePath( hDC );

         SelectObject( hDC, hOldPen );
         DeleteObject( hPen );
      }

      return TRUE;
   }
				

APPLIES TO
  • Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
    • Microsoft Windows 95
    • Microsoft Windows 98 Standard Edition
Keywords: 
kbbug kbmetafile kbgdi kbcode KB196299