BUG: ExtCreatePen Functionality Unavailable in Enhanced Metafile

ID: Q196299

The information in this article applies to:

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

Additional query words:
Keywords          : kbcode kbGDI kbMetafile kbSDKPlatform kbWinOS95bug kbWinOS98bug 
Version           : WINDOWS:
Platform          : WINDOWS
Issue type        : kbbug

Last Reviewed: December 1, 1998