unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
aMsgDialog: TForm;
implementation
{$R *.DFM}
function MsgBox(psCaption:
string; psText:
string; nHeigth: Integer;
aMsgDlgType: TMsgDlgType; aMsgDlgBtn: TMsgDlgButtons; aMsgDlgBtnDef:
TMsgDlgBtn): Integer;
var
iModalRes: Integer;
begin
iModalRes := ID_NO;
aMsgDialog := CreateMessageDialog(psText, aMsgDlgType, aMsgDlgBtn);
with aMsgDialog
do
begin
BringToFront;
Caption := psCaption;
ClientHeight := nHeigth;
BorderIcons := [];
// Keine Border-Icons
BorderStyle := bsNone;
// Keine Titelleiste
FormStyle := fsStayOnTop;
Top := (Screen.Height
div 2) - (Height
div 2);
SetWindowPos(
Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE
or SWP_NOMOVE
or SWP_NOSIZE);
iModalRes := ShowModal;
Free;
end;
Result := iModalRes;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// Aufruf:
case MsgBox('
Caption', '
Text im Dialog', 75, mtConfirmation, [mbYes, mbNo,
mbCancel], mbNo)
of
ID_YES: Close;
ID_NO: Close;
ID_Cancel: ;
end;
end;
end.