When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works.

Microsoft engineer explains how even the Windows clipboard is optimized for best performance

Windows 10 and 11 Wallpapers

Raymond Chen, a senior Microsoft engineer, often tells interesting tales about Microsoft or Windows. For example, recently, he shared some more details about the Janet Jackson song that is officially a cyberthreat for Windows computers and how some OS features like the APO were used to protect PCs.

Chen shares these stories in his The Old New Thing column on Microsoft's site and in the latest post, he has described how the Windows native clipboard is different from other clipboard managers but in a good way.

For those who may not be familiar, Windows offers a default clipboard that can be enabled via the Settings app. There is a simpler way, too, by using the Win + V shortcut and then selecting the "Turn on" option.

In this latest story, Chen answers a question that some of you may have noticed and wondered: "Why doesn’t Clipboard History capture rapid changes to clipboard contents?" Chen says that the asynchronous approach is actually what makes the Windows one better, at least in terms of performance, as it does not slow down the system with constant changes.

Windows is able to achieve this using the AddClipboardFormatListener function and the WM_CLIPBOARDUPDATE message identifier. The former is part of the Winuser header (.h file) wherein winuser.h file helps to handle various user-side inputs like keyboard and mouse, among others. These Windows API features were introduced with Windows Vista.

Explaining how all this works, Chen writes:

The clipboard history service operates asynchronously. It registers for clipboard changes via AddClipboardFormatListener, and when it receives a change notification, it updates the clipboard history. The listener is notified asynchronous, however, so by the time the listener receives the WM_CLIPBOARDUPDATE message, the clipboard may have changed a second time.

This is different from clipboard viewers, which are notified synchronously when the clipboard changes. The downside is that you might miss out on clipboard changes. The much better upside is that you don’t slow down or hang the clipboard.

Thus, it looks like Microsoft has taken an approach such that even something like the clipboard has been created in a way so that it does not affect the performance of the OS. It is good to see that the company takes care of these small yet significant things in order to make Windows great.

Report a problem with article
The Visual Studio Code logo
Next Article

Visual Studio Code 1.100 launched with custom instructions and reusable prompts for Chat

Google Messages Logo
Previous Article

Google Messages finally brings "Delete For Everyone" for those embarrassing moments

Join the conversation!

Login or Sign Up to read and post a comment.

12 Comments - Add comment