BUG: ExtCreatePen Functionality Unavailable in Enhanced Metafile (196299)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • Microsoft Windows 95
    • Microsoft Windows 98

This article was previously published under Q196299

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;
   }
				

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbBug kbcode kbGDI kbMetafile KB196299