What are system message boxes?
The system message boxes means the UI are called from Windows, the client apps only need to customize their icon, text, title, etc. Looks like this:Why need to get the text?
Sometimes, we need to copy the text of the pop-up message box in some applications – writing needs or use in the screenshot disabled occasion.
How to copy text from a system message box?
This seems very difficult to achieve, and maybe need special software to do it.But, in fact, it's easy, very easy, but why most people don't know this easy way – because the programmers do not need to read the source code of MessageBox, and most normal computer users are impossible to try this way.
The answer is easy too: just press <Ctrl+C>.
For instance: when you try to close the unsaved document in Notepad, you will get the following Windows system message box:
When you see this box, please press <Ctrl+C> directly to copy all texts on this box to system clipboard, and in other place that accepts text inputting, press <Ctrl+V> to paste the text. For example, now I press <Ctrl+V> in a new Notepad window will get the following content:
[Window Title]
Notepad
[Main Instruction]
Do you want to save changes to Untitled?
[Save] [Don't Save] [Cancel]
Is it magical and simple?
Remark
1. This way only acts on the Windows system message dialog boxes that called by most applications (information, question, warning and exclamation).2. Usually, it acts on non-Windows OS message boxes, for instance: in Windows 10, you cannot use <Ctrl+C> keys to copy the texts from "Delete File" (for confirmation) dialog box.
Source Code Reference
There is the related code in Delphi, for your reference:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | procedure TMessageForm.CustomKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Shift = [ssCtrl]) and (Key = Word('C')) then begin Beep; WriteToClipBoard(GetFormText); end; end; function TMessageForm.GetFormText: String; var DividerLine, ButtonCaptions: string; I: integer; begin DividerLine := StringOfChar('-', 27) + sLineBreak; for I := 0 to ComponentCount - 1 do if Components[I] is TButton then ButtonCaptions := ButtonCaptions + TButton(Components[I]).Caption + StringOfChar(' ', 3); ButtonCaptions := StringReplace(ButtonCaptions,'&','', [rfReplaceAll]); Result := Format('%s%s%s%s%s%s%s%s%s%s', [DividerLine, Caption, sLineBreak, DividerLine, Message.Caption, sLineBreak, DividerLine, ButtonCaptions, sLineBreak, DividerLine]); end; |
Tip: we also produced a powerful and popular utilities kit for Windows - WinExt®, feel free to try it on your PC.