According to a report by Neowin today, Raymond Chen, a senior engineer at Microsoft, updated his blog post in the column “The Old New Thing” on Microsoft’s website, in which he detailed the differences between the Windows local clipboard and other clipboard managers, and explained why this design is beneficial. Microsoft engineers demystify how Windows clipboard is optimized: how to get the best performance
Microsoft engineers demystify how Windows clipboard is optimized: how to get the best performance
Note: Windows provides a default clipboard, which can be turned on through “Settings” or directly by the Win + V shortcut.
In this article, Raymond Chan answers a question that may be questioned: “Why can’t clipboard history capture rapid changes in clipboard content?” He says that using asynchronous processing actually makes Windows’ clipboard feature more performant, because it doesn’t affect the system speed due to frequent changes.
Windows is able to do this through the AddClipboardFormatListener function and the WM_CLIPBOARDUPDATE message identifier. AddClipboardFormatListener is part of the Winuser header file (.h file) that helps handle various user inputs such as keyboard, mouse, etc. These Windows API features were first introduced in Windows Vista.
He writes:
The clipboard history service works asynchronously. It registers clipboard changes via AddClipboardFormatListener, and updates the clipboard history as soon as it is notified of the change. Because the listener receives notifications asynchronously, the clipboard may have changed a second time by the time the WM_CLIPBOARDUPDATE message is received.
This is different from the clipboard viewer, which syncs notifications every time the clipboard changes. The downside of synchronous notifications is that you may miss some changes to the clipboard, while the benefit of asynchronous is that the clipboard update doesn’t slow down or stutter the system.
发表回复