Solved

Determining ENHMETAFILE original position on page

Posted on 2002-05-13
2
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Event ID 10010 3 80
Problem to packaging 1 127
Problem to DocumentFormat 8 147
Trouble installing msi file with msiexe.exe 2 49
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…

734 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