?
Solved

Determining ENHMETAFILE original position on page

Posted on 2002-05-13
2
Medium Priority
?
217 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 600 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
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 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, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

764 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