How can I hide the message box of my application when vcl styles are activated?

I use Application.MessageBox to display messages in my VCL application, but when the application applied the vcl style, the message box is displayed with the window, and not with the current vcl style.

Code example

Application.MessageBox('Hello World', 'Hello', MB_OK + MB_ICONINFORMATION); 

Image example

enter image description here

How can I show a message box with the current vcl style?

+7
source share
1 answer

The Application.MessageBox function internally calls the WinAPi MessageBox function, this window is not a form created by delphi, therefore it cannot be hidden by Vcl styles. Instead, you should use one of the classes and dialog functions declared in the Vcl.Dialogs module as the MessageDlg function.

 MessageDlg('Hello World', mtInformation, [mbOK], 0); 

enter image description here

+14
source

All Articles