Loading ...
Sorry, an error occurred while loading the content.

Ole Clipboard or Drag drop of Metafile image

Expand Messages
  • arasakumaran
    I am porting some code from MFC. I need to place a metafile ( or enhanced metafile) into the data-object being used for the drag/drop. There are IDataObject
    Message 1 of 3 , Apr 14, 2010
    • 0 Attachment
      I am porting some code from MFC. I need to place a metafile ( or enhanced metafile) into the data-object being used for the drag/drop. There are IDataObject implementation samples to do this that work fine (one from Viksoe, one in Codeproject from Dunn etc. ) for text, bitmap etc. But I don't know quite how to do this for CF_ENHMETAFILE.

      Also, MFC uses 'm_hAttributeDC' to help in some of the text/drawing functions while drawing in metafileDC - how would I do the equivalent in WTL, the drawing code uses GetTextExtentEx, which fails in the metafile DC.

      Thanks.
    • Angus Comber
      In this situation I would make a MFC example and just step thru the code. You have the MFC sources do you not? ... From: arasakumaran
      Message 2 of 3 , Apr 15, 2010
      • 0 Attachment
        In this situation I would make a MFC example and just step thru the code. You have the MFC sources do you not?


        -----Original Message-----
        From: "arasakumaran" <arasakumaran@...>
        Date: Thu, 15 Apr 2010 02:44:57
        To: <wtl@yahoogroups.com>
        Subject: [wtl] Ole Clipboard or Drag drop of Metafile image

        I am porting some code from MFC. I need to place a metafile ( or enhanced metafile) into the data-object being used for the drag/drop. There are IDataObject implementation samples to do this that work fine (one from Viksoe, one in Codeproject from Dunn etc. ) for text, bitmap etc. But I don't know quite how to do this for CF_ENHMETAFILE.

        Also, MFC uses 'm_hAttributeDC' to help in some of the text/drawing functions while drawing in metafileDC - how would I do the equivalent in WTL, the drawing code uses GetTextExtentEx, which fails in the metafile DC.

        Thanks.




        [Non-text portions of this message have been removed]
      • arasu
        Thanks for the response. Yes I looked at the MFC source.  Two things with the MFC code.  MFC s CMetafileDC class has an m_hAttribDC which is typically set to
        Message 3 of 3 , Apr 15, 2010
        • 0 Attachment
          Thanks for the response.

          Yes I looked at the MFC source.  Two things with the MFC code.  MFC's CMetafileDC class has an m_hAttribDC which is typically set to the screen's sometimes to a printer's dc. While drawing, MFC uses this m_hAttribDC as opposed to the m_hDC for measuring, setting mapmode etc.  WTL does not have this and if I am to duplicate the drawing code. I need to derive a class from CDC or from CEnhMetaFileDC and add this reference hdc and duplicate some of the code.

          As to placing the enhmetafile on to the DataObject, the MFC code places a metafile rather than enhmetafile.  The code creates a metafile header structure in HGlobal, fills that structure with information about the metafile (size, handle etc..) and places that with CF_METAFILEPICT as the clipboard format.  I don;t have an enhmetafile example even in MFC.   Now, EnhMetafile is supposed to already contain the size, name and such information in addition to the metafile records & there is both clipboard format for enhanced metafile as well as a TYMED for it.  So I was hoping to do this a bit more straightforward, such as by just placing the HENHMETAFILE handle in the STGMEDIUM as part of SetData  Does not seem to work though

          Don;t know if all that made sense, but I can post the code I tried if needed.



          --- On Thu, 4/15/10, Angus Comber <angus@...> wrote:

          From: Angus Comber <angus@...>
          Subject: Re: [wtl] Ole Clipboard or Drag drop of Metafile image
          To: wtl@yahoogroups.com
          Date: Thursday, April 15, 2010, 2:00 AM







           









          In this situation I would make a MFC example and just step thru the code. You have the MFC sources do you not?



          -----Original Message-----

          From: "arasakumaran" <arasakumaran@ yahoo.com>

          Date: Thu, 15 Apr 2010 02:44:57

          To: <wtl@yahoogroups. com>

          Subject: [wtl] Ole Clipboard or Drag drop of Metafile image



          I am porting some code from MFC. I need to place a metafile ( or enhanced metafile) into the data-object being used for the drag/drop. There are IDataObject implementation samples to do this that work fine (one from Viksoe, one in Codeproject from Dunn etc. ) for text, bitmap etc. But I don't know quite how to do this for CF_ENHMETAFILE.



          Also, MFC uses 'm_hAttributeDC' to help in some of the text/drawing functions while drawing in metafileDC - how would I do the equivalent in WTL, the drawing code uses GetTextExtentEx, which fails in the metafile DC.



          Thanks.



          [Non-text portions of this message have been removed]

























          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.