WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: fhammer on January 05, 2016, 04:58:00 PM

Title: Save & Restore ENTIRE Clipboard
Post by: fhammer on January 05, 2016, 04:58:00 PM
Is there a way to save the ENTIRE ckipboard at the start of a program, then restore the ENTIRE clipboard prior to exiting?

I'm not just referring to text and not just a specific format. I use the clipboard for various things in my programs. However, it would be nice if the user could rely on clipboard contents being the same as before the program was invoked.

The standard clipboard functions don't appear to do the trick, as they are format-specific. BinaryClipPut for example, only resores one format, and appears to destroy the other formats. Thus, even multiple sequential calls, with different (saved) formats, would not restore all formats.

Also, is there a tech paper on Clipboard management?

Thanks
Title: Re: Save & Restore ENTIRE Clipboard
Post by: td on January 06, 2016, 10:48:49 AM
Sound a bit like your programs are not following recommend standards for using the clipboard, if you feel you need to restore user content.  MFST documentation states that  "The clipboard is user-driven. A window should transfer data to or from the clipboard only in response to a command from the user."

Also MSFT states that "To place information on the clipboard, a window first clears any previous clipboard content ."  The BinaryClipPut function follows the MSFT recommend  practice for placing information on the clipboard.

If you wish find out more about the clipboard and its proper usage, use your search engine of choice to find the clipboard Win32 function documentation on MSFT's MSDN Website (Google "clipboard site:microsoft.com" sans double quotes.)