Place a enhanced metafile on the clipboard (uses OLE)

(1) If you don't have OLE in your project already then add this
#include < afxole.h >

and do the following during initialization

(2) The following places a metafile copy of a view on the clipboard. It can be easily modified to work with any CWnd that draws to a CDC.

void CMyView::OnEditCopyWmf() 
	tagSTGMEDIUM * data;
	CClientDC dcRef( this );
	data = new tagSTGMEDIUM;
	CMetaFileDC * dcMeta;
	dcMeta = new CMetaFileDC();
	COleDataSource* pData = new COleDataSource;
	CRect lmbr;
	//replace "ImageName" with a description of this image
	dcMeta->CreateEnhanced(&dcRef, NULL, NULL,"ImageName\0Copy\0\0" );
	//actually draw to the device context
	//done drawing
	data->tymed = TYMED_ENHMF;
	data->hEnhMetaFile = dcMeta->CloseEnhanced();
	pData->CacheData( CF_ENHMETAFILE, data );
	delete dcMeta;
	delete data;


  • Monster beats, een eerbetoon merk met de nieuwe stijl en materiaal

    Posted by mrswanzi on 06/06/2013 02:43am

    [url=]beats by dre[/url] Wanneer je te voet over straat loopt is een open constructie veel beter, omdat je dan het verkeer en omgevingsgeluiden gewoon kunt horen. Een open koptelefoon voelt bovendien prettiger aan en heeft een natuurlijkere weergave. Dit resulteert in een ontspannender luistergenot. Wanneer je in het bezit bent van de Real dan kun je je op vele situaties verheugen: studeren met de Real, joggen met de Real, gamen met de Real, films kijken met de Real, werken met de Real, en nog veel meer! Met de de Real creer je je eigen universum en ga je op in jouw moment! Voordelen van high definition verslaan Dr Dre hoofdtelefoon [url=]monster beats koptelefoon[/url] Met de Beats by Dr. Dre Wireless geniet je van volledige muzikale vrijheid. De draadloze hoofdtelefoon, in het design van de populaire Solo HD, beschikt over Bluetooth waarmee je hem eenvoudig koppelt aan je smartphone (of mp3-speler met Bluetooth). Alle benodigde bedieningsknoppen voor volume, het skippen van nummers of het aannemen of beindigen van een telefoongesprek zijn geplaatst op de rechteroorschelp en dus altijd binnen handbereik. [url=]beats solo kopen[/url] Naast dat je je muziek wireless kunt beluisteren via bluetooth kun je er ook altijd nog voor kiezen om gewoon de meegeleverde kabel te gebruiken. Bijvoorbeeld wanneer je via een apparaat luisterd wat geen bluetooth ondersteund. Of als dat batterijen voor de bluetooth funcie leeg zijn (deze gaan ongeveer 10 uur lang mee).De komende de Monster Beats Dr Dre urBeats koptelefoon

  • Headphone isnot barely a headphone,is a window to see the exceptional

    Posted by motherdhmm on 06/04/2013 09:08am

    [url=]beats headphones Australia[/url] In just out years, in any way, the stalwart emulsion form seems to fit in since last year, HTC shares Beats by dre, launched the Beats Audio models of new Android phones, Nokia also see fit be the occasion of the inaugurate of Windows Phone the Lumia series phone, also announced that Co-brand the on the move (note: co-branded, two or more of a combination of known brand.) together with Eyesore society launched a different 2 uncommonly delightful quick phone communications headset models were: notice WH-920 and the headset WH-930. I practised from Wuhan Liancheng phone Nokia Salubrity of Monster WH-930, the pen-pal strength be interested to be sure more less the next! [url=]monster beats headphone[/url] The absolutely newest headphones all past applying the Beats admired sorts could be the ¡°Beats Solo HD,¡± beats nigh dre a high-definition on-ear headphone, which could be achievable in red-colored or black. There could be the ¡°Pro¡± model,dr dre beats spidermanan over-the-ear DJ headphone which could be achievable in if possible pale or white. Beats as well partnered with HP to galvanize laptop computer clandestine computer clandestine laptops with high-end audio approach aid capabilities. [url=]beats studio[/url] In just out years, in any way, the intense compound modus operandi seems to fit in since last year, HTC shares Beats by dre, launched the Beats Audio models of chic Android phones, Nokia also see fit be the occasion of the inaugurate of Windows Phone the Lumia series phone, also announced that Co-brand the way (note: co-branded, two or more of a league of well-known brand.) together with Eyesore entourage launched a remodelled 2 mere appealing sensitive phone communications headset models were: notice WH-920 and the headset WH-930. I learned from Wuhan Liancheng phone Nokia Salubrity of Barbarity WH-930, the pen-pal might be interested to distinguish more less the next!

  • Technological requirements wagerer of induction of the Joomla! comfort managing system.

    Posted by carpitzak on 04/16/2013 11:14am

    A compute number of 141 items of clothing were purchased in April 2012 in 29 countries [url=]hollister[/url] and regions worldwide from authorised retailers. The chemicals convince about included outrageous levels of toxic phthalates [url=]abercrombie france[/url] in four of the garments, and cancer-causing amines from the be contemptuous of of non-specified azo dyes in two garments. NPEs [nonylphenol ethoxylates] were establish in 89 garments (unpaid junior to two thirds of those tested), showing [url=]jordan[/url] minuscule imbalance from the results of the untimely determining push into the being of these substances in sports clothing that was conducted in 2011. In into the compact, the vicinity of many other typical types of potentially ticklish industrial chemicals was discovered across [url=]abercrombie france[/url] a covey of the products tested. Disclose of outset on, when women wanted to emulate that look, [url=]jordan[/url] they couldn’t valid mince into a stunner salon and press for the hairdresser to interrupt down slack their tresses into that ungracious, just-below-the-ears style. Uncountable hairdressers [url=]hollister[/url] unreserved doused refused to carry out the numbing and tenderly moot put in proper for And some didn’t separate how to do it since they’d but continuously utilized their shears on wish suggestion [url=]abercrombie uk[/url]. In lieu of of being deterred, the flapper waved mad those rejections and headed to the barbershop on account of the do. The barbers complied [url=]doudoune moncler[/url]. You ascendancy reminisce ended a seldom months ago we shared a enticing meet with disaster styled [url=]air jordan[/url] hurl with this lilting couple. Well, today we are sharing their breathtaking betrothal photos – and then their engaging combining coming up next! You also dominion [url=]michael kors[/url] accept this couple since they in malapropos of in truth met on the tv express Consequential Fellow-clansman! Although they didn’t begin to year until after the display, it’s joking to recall that from time to lifetime rendezvous on a tv make known can entrust [url=]hollister france[/url] in requital for all to speak with, right?The initial half of their spacious bombardment takes emplacement at Salvation Mountain and then it’s unreasonable to the wilderness an eye to some slumberous photos with the most glorious light. And I’m fully loving Dani’s assemblage choices too! Matchless impulse seeing that [url=]louboutin pas cher[/url] those of you planning your engagement photos now.

  • La 2e lieu Revient a juin chaussure de Stuart Weitzman au talon aiguille en metal, Suivi subservient Jimmy Choo sandales juin. Jordan

    Posted by Vetriatszy on 03/15/2013 01:42pm

    ABERCROMBIE LANGE t private information is owned by more youthful, thigh users which are not uneasy to hair the money on their sequence and would like to get accepted. this amazing, woman enjoyment in huge individuality homeowners and gives yearnings concerning becoming incredible. realistically, clothing is good believe to help highlight someone different who the simplest way pretty awesome attractive force unique Going Here abilities. using the reasonably lawsuits, young ladies has become peak place emphasis a tad too. This is disposing of crash in this way within his or her a youngster so, who would delight in having have great new home appliances combined with trendy look and feel eachtime over and above for just a social meeting. Partage diffrents fashion diffrent faire briller l'astigmatisme dans l'instant, la femelle se 'vrrle rrtre maintenant extrmement lgant et luxueux. Dans la poursuite prs dom vie and also supplmentaire et. the monde des marques bien connues Abercrombie as well as Fitch reprsente not model de way, Une way de la compete relle. Au cours du sicle Abercrombie pas cher pass, 19e durante raison, united nations homme jee, Appel steve Abercrombie, A ouverlonger l. a,chicago chris are friends,james. Gwyneth Paltrow existants Vous l. a,chicago manire never ze fondre et en compltfillt l'ensemble des cramique lisr cheveux friss Royaume-Uni Aber

  • How to send the text in a dialog box to clipboard

    Posted by Legacy on 10/24/2002 12:00am

    Originally posted by: Vidya Rajkumar

    I have some 4 edit boxes in a dialog.

    For eg.

    Name Vidya
    Age 23
    Sex Female
    occupation S/W Engineer

    Assume that these are the controls in a single dialog box.

    What i want is,on just pressing a button in toolbar,the data has to be sent to the clipboard ..Note that the nothing is selected or focussed.

    The data in the clipboard should be in the below format
    Name Vidya
    Age 23
    Sex Female
    occupation S/W Engineer

    How is it?

  • oops

    Posted by Legacy on 10/21/2002 12:00am

    Originally posted by: W. J. Heitler

    Sorry, I've just noticed that the SetAtribDC modification was incorported in the earlier comment.
    It's not immediately obvious how to withdraw a comment, but if someone tells me how I'll pull this one and the previous.

  • reading attributes like text height etc

    Posted by Legacy on 10/21/2002 12:00am

    Originally posted by: W. J. Heitler

    Thank you for your code, which is very useful. When I first tried it I had crash problems, because in my standard screen drawing routine I was reading attributes in order to draw text. The following modification seems to have sorted it.

    //done drawing
    dcMeta->ReleaseAttribDC(); // not sure if needed

    I hope this comment may be helpful.

  • Adapted solution with correct rectangle dimensions and some simplification

    Posted by Legacy on 05/08/2002 12:00am

    Originally posted by: Wim

    void CMyView::OnEditCopy()
    // Create an OLE data source on the heap
    COleDataSource *pData = new COleDataSource;
    tagSTGMEDIUM data;
    CClientDC dcRef( this );
    CMetaFileDC dcMeta;
    RECT rect;
    int iWidthMM, iHeightMM, iWidthPels, iHeightPels;

    // Determine the picture frame dimensions.
    // iWidthMM is the display width in millimeters.
    // iHeightMM is the display height in millimeters.
    // iWidthPels is the display width in pixels.
    // iHeightPels is the display height in pixels
    iWidthMM = dcRef.GetDeviceCaps(HORZSIZE);
    iHeightMM = dcRef.GetDeviceCaps(VERTSIZE);
    iWidthPels = dcRef.GetDeviceCaps(HORZRES);
    iHeightPels = dcRef.GetDeviceCaps(VERTRES);

    // Retrieve the coordinates of the client
    // rectangle, in pixels.
    GetClientRect( &rect );

    // Convert client coordinates to .01-mm units.
    // Use iWidthMM, iWidthPels, iHeightMM, and
    // iHeightPels to determine the number of
    // .01-millimeter units per pixel in the x-
    // and y-directions.
    rect.left = (rect.left * iWidthMM * 100)/iWidthPels; = ( * iHeightMM * 100)/iHeightPels;
    rect.right = (rect.right * iWidthMM * 100)/iWidthPels;
    rect.bottom = (rect.bottom * iHeightMM * 100)/iHeightPels;

    // Replace "ImageName" with a description of this image
    dcMeta.CreateEnhanced( &dcRef, NULL, &rect,"ImageName\0Copy\0\0" );
    dcMeta.SetMapMode( MM_TEXT );
    dcMeta.SetAttribDC( dcRef );

    // Actually draw to the device context
    OnDraw( &dcMeta );
    // Done drawing

    data.tymed = TYMED_ENHMF;
    data.hEnhMetaFile = dcMeta.CloseEnhanced();

    pData->CacheData( CF_ENHMETAFILE, &data );

  • Images do not render as expected when pasted to MS Word or MS PowerPoint

    Posted by Legacy on 12/09/2001 12:00am

    Originally posted by: John W. Blakely

         Thank you for the code sample.  I used it in a very simple test application.  Within that application, I draw a box and then write "Hello, World."  However, when I cut that image and paste it into an MS Powerpoint or an MS Word document, the results are not as drawn.  In both cases, the box is visible, but test is not.  Within MS Powerpoint, I can ungroup the image and recover the tst.  The rectangle is drawn as a series of lines and I used MM_TEXT mode to draw the image.

    Some questions:
    1. Is there an agreed map mdoe that is used to cut and past objects?
    2. Is it better to use TextOut or DrawText functions?
    3. What can I do to correctly cut and paste images?

    The nest few lines contain the code I added:
    //actually draw to the device context
    dcMeta->MoveTo(0, 0);
    dcMeta->LineTo(0, 20000);
    dcMeta->LineTo(20000, 20000);
    dcMeta->LineTo(20000, 0);
    dcMeta->LineTo(0, 0);
    dcMeta->TextOut(10000, 10000, "Hello, World.");
    //done drawing

  • How do I edit enhance metafile from clipboard ?

    Posted by Legacy on 08/21/2001 12:00am

    Originally posted by: Sapto Priyono

    I have a enhance metafile which is copied from the shape of Power Point object, but after I play with PlayEnhMetaFile, this enhmetafile has uncorrect displaying (fontsize is not correct, appear bullet in the first character). Why and how do I edit this enhmetafile ?. I have edited it's enhmetaheader, but no influence for the displaying.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date