Solved

Determining ENHMETAFILE original position on page

Posted on 2002-05-13
2
208 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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.…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now