Solved

Determining ENHMETAFILE original position on page

Posted on 2002-05-13
2
206 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
Comment Utility
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
Comment Utility
Thanks for the help!  One is whether these clipboard formats such as "object descriptor" are documented
somewhere ?  Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

13 Experts available now in Live!

Get 1:1 Help Now