Copy message box text to the clipboard
Ever get a error message and need to write it down? Particular one with an obscure error number like 0x80040e09? Starting with Windows 2000, you can copy the entire contents of a message box to the clipboard by pressing CTRL+C.
Software developers often put error messages into a “message box.” A message box is a type of dialog box managed by Windows. It’s very easy to implement from a programming standpoint, and thus many error messages are shown this way.
Users see message boxes all the time. They are the ones with a either a icon to the left and some text. There will be buttons, like OK, Cancel, Yes, No, etc.
To see a message box in action, go to the Start menu and choose “Run…“ Then type in something that doesn’t exist, such as “foobar“ and press Enter (or click OK if you really like moving your hands back and forth from the keyboard to the mouse).
You’ll get a message box dialog that says “Windows cannot find ‘foobar’.“ and a lot more information that I didn’t want to bother to type in manually.
Since the text is presented in a static text box, there is no way to select all or a portion of the text. Another method would be to use the edit text box control, and set the text to read-only. That’s what the Windows shell does for the file property sheets, which allows users to select and copy text such as the full pathname of a file.
In Windows 2000 however, a shortcut was added to the message box code to look for the copy operation. So, if you press CTRL+C, the text of the message will be copied to the clipboard. If you paste it into notepad, it’ll look like this:
Windows cannot find ‘foobar’. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.
I seem to remember this feature being talked about in 1998 as a benefit to accessibility, and it is. I don’t think the feature was added solely for accessibility purposes however.
Now, this only works for message boxes. Many dialog boxes are shown by applications. Those are generated and handled by the application. Only when an application asks Windows to display a message box will this shortcut work. For example, Microsoft Word displays dialogs that appear like message boxes, but they are not. Actually, they aren’t the dreaded Standard Dialog Manager (SDM) type of dialogs either, so Word is all screwed up.
Leave a comment
No comments yet.