ASP.NET Weblogs

The DreamLand Express - Charles Oppermann's Software Blog

Commentary on software design, development and management

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.

Published Apr 08 2004, 05:53 PM by ChuckOp
Filed under: , ,



AT said:

;o) I had a bug report filled on this during Windows NT 5 (aka 2000) beta
April 9, 2004 12:48 AM

error1143 said:

Mark this day... Thursday, April 08, 2004 5:53 PM
Chuck said.... "Word is all screwed up". :-)
April 9, 2004 3:47 PM

Prasad Dange said:

This is a great help to me

June 23, 2004 10:01 AM

oou said:

thanks it' so good
July 13, 2004 11:20 PM

aaron said:

Or you could, ya know, take a screen shot...

June 13, 2007 5:59 PM

gaxxa said:

mmm, aaron, if you know some way of using the 'text' in a screen shot to do a Google search please let me know ....

June 13, 2007 6:47 PM

blat said:

aaron: the point here is to have the error as text, for pasting into google, or perhaps an email to a developer.

i bet you'd save that screenshot as a bmp, too.. wouldn't you.

June 13, 2007 7:08 PM

cybertyrant said:

Gee.e..... Thanks..... This is so-so-so useful

June 13, 2007 7:21 PM

Aaron said:


step one: screen shot error message

step two:

step three: look at screenshot and enter keywords

you don't need the ENTIRE message for a Google search. It's robust enough to only require keywords. That's the whole point, but I guess Windows is all about doing things the hard way :)

June 13, 2007 8:05 PM

gs said:

Aaron, a pen and a piece of paper is just as convoluted as your suggestion. CTRL+C saves you two steps and the headache.

June 13, 2007 9:05 PM

chiefbutz said:

And why didn't MS tell us about this? Oh wait, that is a no brainer, they wanted to make us SUFFER!

June 13, 2007 10:10 PM

Yoga said:

Great thank u

June 13, 2007 11:46 PM

William Furr said:

Wow.  Such a useful feature, but I had no idea.  Seven years after release, it finally percolates it's way to me.  Huh.

June 14, 2007 12:05 AM

Jitendra Bangani said:

This is a very useful tip...


June 14, 2007 1:47 AM

chriso said:

Ay carumba! I can't believe that this isn't more widely known!  So many times I despair of those stupid un-selectable error message boxes.


June 14, 2007 4:48 AM

Chris Mikaitis said:

I'm too lazy to check if this has been said, but 'CTRL+Print-Screen (or CTRL+SHIFT+Print-Screen... one does entire screen, one does active window) copies a shot of the entire screen to the clipboard.  Also very useful.

June 14, 2007 6:32 AM

Tan said:

Aaron: you're either kidding, or you've never used windows at all.

June 14, 2007 7:47 AM

Koushik said:

Thanks, this is very useful and rare info. Really saves time on those awfully obstruse error boxes you see - even if you want to file a bog on the app that thew it, it is far easier to communicate the text rather than a screenshot.

I stumbled on an example to demonstrate this with fewer steps, though.

Open notepad and type some junk, when u close notepad, it displays a message box asking if you want to save the file... Ctrl+C and paste it into notepad (after disposing of the message box with No/Cancel, of course) and voila...

June 14, 2007 3:07 PM

Cernansky said:

Screen shots are wasteful. Tech support is part of my job and our databse gets reams of screen shot bitmaps ranging in size up to 5 MB just so the users can send us a 15 word dialog box message without typing for a few seconds.

Thanks ChuckOp!

June 14, 2007 3:28 PM

sean said:

Great tip! Thanks :)

June 14, 2007 7:15 PM

ankh said:

why screenshot when you can have it paste into a text file or directly into google?

with screenshot you still have the same steps as copy and paste but with this at least you don't have to type out the words from the screenshot into a web browser. if it cuts down an extra step why not?

June 14, 2007 10:12 PM

Matt Ireland said:

Dude! That's so cool!

June 16, 2007 3:03 PM

Neil Halloran said:

I have always hit print screen and open word and paste it

June 18, 2007 3:35 PM

Stephen said:

I much prefer screenshots because they often let you see where the user was when when the error message appeared.

June 19, 2007 4:31 AM

Mike said:

Utterly brilliant!

Why hasn't this come up before?

June 19, 2007 2:28 PM

David Rogers said:

Awesome functionality. Thanks!

December 20, 2007 1:59 PM

fojie said:

Great help.. Thanks! :-)

February 14, 2008 12:30 PM

shiyon said:

Thanks a million..!!

May 29, 2008 5:10 AM

mediaservant said:

thanks for the tip.  Saved me a boatload of trouble!

September 4, 2009 10:09 AM

Tom said:

Thanks dude u made my day

May 27, 2010 2:19 PM

Omaer said:

I was using this till Windows XP, but just switched to Windows 7, and it no longer works. Any suggestions?

January 8, 2011 11:47 PM

ChuckOp said:

@Omaer:  It still works in Windows 7.  But like I said in the original post, this only works for message boxes.  Many application display information using dialog boxes that look like message boxes, but since they aren't real Windows message boxes, the CTRL+C shortcut won't work.

January 9, 2011 9:53 AM

Tim said:

Thanks, that's really useful!

August 15, 2011 9:12 AM

Responsive web design said:

Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.

May 10, 2012 9:29 AM

Lifesart said:

Thank you! thank you! thank you! a thousand times over!!  This has plagued me for years with internal system errors that use 30 - 50 character batch numbers, so easy to get wrong when copying by hand.

November 1, 2013 10:25 AM

Leave a Comment


About ChuckOp

Charles Oppermann is 25-year veteran of software design. He is the original author of the popular JAWS screen reader for people with visual impairments, and spent over a decade at Microsoft working on accessibility and user experience in the Windows, Internet Explorer and speech product groups. Charles was a representative to the W3C and Web Accessibility Initiative (WAI), and the author of two technical books published by Microsoft Press. He has also worked at Cisco Systems,, and is currently Program Manager and Development Supervisor for Consumer Security Products at GFI Software.