This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: example needed pls: `cygpath -c <HANDLE>'


Brian Dessent <brian@dessent.net> wrote around 02 Jul 2003 
3F02DD3F.3EAA4D3E@dessent.net:">news:3F02DD3F.3EAA4D3E@dessent.net:

> Oops, I left off a call to GlobalFree(hglbBuffer); before exiting.  Or
> maybe not, I'm not sure with this global heap business that you have to
> use when working with the clipboard... Anybody know if the system frees
> that clipboard data the next time the clipboard is emptied, or do you
> have to do it before your program exits?

You did it right. A book I have [Windows 98 Developers Handbook, Ezzell & 
Blaney, Sybex, 1998] says

  Do not under any circumstances free memory after transferring
  a data object to the clipboard. [...] The result of calling
  GlobalFree would delete the item from the clipboard. Instead,
  once a data item has been transferred, ownership of the item
  has also been transferred, and the local handle should not be
  used or tampered with further.

You are correct in guessing that the next time an application calls 
EmptyClipboard the global memory is freed by the Clipboard itself.

-- 
"So, tell me, my little one-eyed one, on what poor, pitiful,
defenseless planet has my MONSTROSITY been unleashed?"
                       - Dr. Jumba, Disney's "Lilo & Stitch"
OpenPGP Key at http://savannah.gnu.org/people/viewgpg.php?user_id=6050


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]