Ctrl-C to capture MessageBox and dialogs

There was a tip at SouthWest Fox conference attributed to Drew Speedie. Ctrl-C on an error dialog captures the text of the dialog including the error message to the clipboard.

Try this:

Type x=y in the command window and hit enter to cause an error message: Then hit Ctrl-C to copy the contents of the dialog to the clipboard.

This is what I get:

Microsoft Visual FoxPro

OK

Help

Variable 'Y' is not found.

Or try this to execute a VFP command:

_vfp.DoCmd("this is not a VFP command")

Microsoft Visual FoxPro

OK

Help

OLE IDispatch exception code 0 from Visual FoxPro for Windows: 16 :Unrecognized command verb...

I implemented this feature for not just the error dialog, but all VFP dialogs, FWIW. The error dialog is just another native VFP dialog. It only copies certain controls to the clipboard. For tabbed dialogs, it only copies the active page.

Open any VFP native dialog, such as Tools->Options or View->Toolbars and copy that!

It won’t work with VFP forms, such as any wizard, because they’re not native VFP dialogs.

This also works for Windows based MessageBox (which is not a VFP dialog!). Try this:

MESSAGEBOX("Hit Ctrl-C to copy the text of this MessageBox to the clipboard")

---------------------------

Microsoft Visual FoxPro

---------------------------

Hit Ctrl-C to copy the text of this MessageBox to the clipboard

---------------------------

OK

---------------------------

The clipboard is useful in other ways. You can always capture the image of any dialog or even any entire window by hitting Alt-PrtScrn or Ctrl-Prtscrn. This will capture the active window or the active Dialog as an image to the clipboard.

(I’m composing this at the Phoenix airport)