Solved

Determining ENHMETAFILE original position on page

Posted on 2002-05-13
2
211 Views
Last Modified: 2013-12-03
When an EnhMetaFile is copied to the clipboard, I need to
know the position the object occupied on the page the copy
operation was done on.

What I mean is this. I use Powerpoint to create something,
then do a mark-all and copy to put it onto the clipboard.
It is copied to the clipboard as an EnhMetafile.

Is there any way an application that retrieves the
EnhMetaFile from the clipboard can determine what the
offsets were from top and left of the page(window) the
object was originally copied from.

Powerpoint seems to be able to find this data. If I mark-all, copy something, close and reopen PowerPoint, and then
paste, the object is pasted to the page exactly where it was copied from.

When I do a GetEnhMetafileHeader, I don't see anything there where the information is saved.
0
Comment
Question by:keevint
2 Comments
 
LVL 9

Accepted Solution

by:
BeyondWu earned 200 total points
ID: 7007775
It depend on which application set the clipboard. :o(
I think powerpoint must set other infos in the clipboard except ENHMETAFILE. If you want to compatible with it, you should analyse the format which powerpoint setted.

For example:
When you copy to clipboard, you can use
// Register your own position format
m_myPosFormat = RegisterClipboardFormat(_T("EMF_POS"));
// ...
SetClipboardData(CF_ENHMETAFILE, hMem);

typedef _POSStruct
{
    POINT  m_point;
    // ... other infos ...
}MYCOPYPOS, * LPMYCOPYPOS;

HGLOBAL hPos = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(MYCOPYPOS));
// Set positon info to the memory
LPMYCOPYPOS pPosFormatStruct = GlobalLock(hPos);
// set the position info to it.
pPosFormatStruct->m_point.x = ...;
//...
SetClipBoardData(m_myPosFormat, hPos);
//...

If the client of clipboard know the info, it can get it from EMF_POS format. I think the powerpoint have the same
info(it seems the "Object Discriptor" containts the inof).
0
 

Author Comment

by:keevint
ID: 7010968
Thanks for the help!  One is whether these clipboard formats such as "object descriptor" are documented
somewhere ?  Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question