Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Converting a handle to a structure

Posted on 1998-06-12
3
Medium Priority
?
284 Views
Last Modified: 2010-04-10
I have a handle returned from the clipboard which points to a metafile. I want to convert it to the metafile structure so that I can save it to the disk.

How can I do it.

Thanks in advance

nikhilh
0
Comment
Question by:nikhilh
[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
3 Comments
 
LVL 1

Expert Comment

by:Andy_Keys
ID: 1165727
I assume the handle from the cipboard is a handle to a global memoy block in which case you should be able to do somthing like
GlobalLock this returns a ptr to the data so you can cast this to a ptr to the metafile struct.
0
 
LVL 2

Author Comment

by:nikhilh
ID: 1165728
It does not work
0
 

Accepted Solution

by:
unmeshv earned 100 total points
ID: 1165729
If it is an handle to metafile, i.e. HMETAFILE (if it is HENHMETAFILE for enhanced meta files) try using CopyMetaFile or CopyEnhMetaFile functions.

It is something like

CopyEnhMetaFIle(hMetaFileHandle, *pFile);
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

722 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