Reputation: 489
we are working on Delphi 7. Recently we have moved from Windows Server to windows 7. we are handling all the error messages in our application through MessageBox. MessageBox appearance is different in Windows Server 2003 and windows 7. Please find below screen shots, which shows difference in windows server 2003 and windows 7.
we want windows 7 message box to display same like windows server.
Upvotes: 2
Views: 286
Reputation: 613521
The MessageBox
API is implemented by the system. It is a dialog implemented by Win32 in the user32 module. So you are just picking up the standard Windows dialogs. If you try to replicate the old XP/2003 dialogs on Windows 7, your application will look out of place.
Now, if you are absolutely desperate to replicate the XP/2003 appearance, then you cannot do that through MessageBox
. You would need to create your own dialog. Create a form. Add a TImage
for the icon, a label for the text, and whatever buttons you need. Show the form with ShowModal
. Indeed, the Dialogs
unit has a function that creates just such a form, CreateMessageDialog
.
var
MessageBoxForm: TForm;
....
MessageBoxForm := CreateMessageDialog('Your message goes here', mtError, [mbOK]);
Try
MessageBoxForm.ShowModal;
Finally
MessageBoxForm.Free;
End;
And there's even a simple wrapper that allows this one-liner:
MessageDlg('Your message goes here', mtError, [mbOK], 0);
That is how to do what you ask but I cannot endorse that as being a good idea. Times change, and it is usually best to move with the times.
Upvotes: 4