Solved

GlobalLock and GetClipboardData

Posted on 1998-10-15
2
792 Views
Last Modified: 2011-09-20
I'm using VC++ 6.0.  I'm calling the SDK function GetClipboardData in my program.  It returns a HANDLE.  I was calling GlobalLock to get a poiner to the data.  However, GlobalLock "is provided only for compatibility with 16-bit versions of Windows".

So, is there a better way of getting the data pointer without using the 16 bit SDK ?
0
Comment
Question by:jlugo
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1175240
The docs aren't 100% correct.  This is one of the few cases where it is needed.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175241
What the documentation is trying to say is that GlobalAlloc() and the related function are no longer used for allocating memory for use by the program.  A C++ program should use new to allocate memory for its use or in some cases can use the win32 heap functions to allocate memory.  However, the global allocation functions are still needed in cases like the clipboard where memory muyst be allocated by your program, but then is "managed" (used and then deleted) by the operating system.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

705 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