Re: rookie's question about using clipboard by Stephen
Stephen
Fri Aug 15 10:19:04 CDT 2003
cure wrote:
> I was reading Charles Petzold's "Programming Windows" book.
> In the Clipboard chapter, the author says that
> every "OpenClipboard()" function call should be followed
> by a "CloseClipboard()". But in the Blowup.c example
> (Figure 14-21), there isn't a CloseClipboard() call after
> OpenClipboard(). (page 719, under "case IDM_EDIT_COPY")
> And the program runs fine.
> So should OpenClipboard() and CloseClipboard() always come
> in pairs or not?
> Thanks!
Does the sample code call CloseClipboard() at all? If not, the book is
probably wrong then. (I too have that book - 5th edition - but I don't
remember reading about the clipboard stuff in it - nor do I have it at hand
at the moment so I can't look for myself)
An application should call the CloseClipboard() function after every
successful call to OpenClipboard().
So yes, they probably should come "in pairs", as you put it. Better to be
safe than sorry! :-)
Regards,
Stephen.