github/sowbug

Copying MessageBox text

It is a small pet peeve of mine that many people in software development use screenshots to send around reports of errors in Windows applications. The path of least resistance is to press the Print Screen key and paste the resulting BMP in email. These files can be multiple megabytes. Even if you use alt- PrtScn, which copies just the active window, that’s typically 350KB. Moreover, it loses critical information: if the recipient actually wants to grep source code for the error message, he or she must retype the string in question.

Instead, try pressing control-C. This copies the text of any standard messagebox (including assertion failure dialogs) into the clipboard.

Example:

---

---

---

---

---

---

----------
Microsoft Visual C++ Debug Library
=---------------------------
Debug Assertion Failed!

Program: temp_demo_project.exe
File: c:\foo.cpp
Line: 40

Expression: 2 == 1

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
=---------------------------
Abort   Retry   Ignore
=---------------------------

Thanks to Adam Dingle for the tip.