Autor Beitrag
Green
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 13.11.05 16:47 
Also, ich möchte eine MessageBOx mit den folgenden Parametern intialisieren und dann Abfragen.

ausblenden Delphi-Quelltext
1:
MessageBox(NULL,'Willst du wirklich beenden und dich ausloggen?','Beenden...',MB_YESNOCANCEL)					


Aber wie kann ich das jetzt abfragen? Wenn ichs mit case .. of verusche oder if .. then .. else dann kommt immer 'Invalid Varinat Type Conversion'...

Was macht man da???

MfG Green
starsurfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: So 13.11.05 16:53 
ausblenden Delphi-Quelltext
1:
if MessageDlg('Beenden?',mtConfirmation, [mbYes, mbNo], 0) = mryes then close;					


so, aber eben mit messagedlg :D

oda:
ausblenden Delphi-Quelltext
1:
if Application.MessageBox('Beenden','beenden',MB_OKCANCEL + MB_DEFBUTTON1) = IDOK then close;					

_________________
GEIZ IST GEIL! - Ihr Sozialamt
Green Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 13.11.05 18:16 
Soweit geht das...
aber da das ganze in FormClose steht beendet er wenn man auf OK klickt, wie gewünscht, aber wenn man auf abbrechen klickt auch, da ja der Rest von FormClose ausgeführt wird.
Ein EXIT anhängen bringt nix... also was machen?
Kroni
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: So 13.11.05 18:20 
Machs mal im OnCloseQuery;
Da kannste dann mit CanClose sagen, ob der Beenden soll oda nit (CanClose:=True lässt das Prog beenden)
Also machste ne Abfrage if Not if MessageDlg('Beenden?',mtConfirmation, [mbYes, mbNo], 0) = mryes then canclose:=true else false;
Habs in meinen alten Progs imma so gemacht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.CloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if (messagedlg('Möchten sie wirklich Beenden?',
                     mtconfirmation,[mbyes,mbno],0)=6) then  //ja geklickt
   canclose:=true
else
   canclose:=false;

end;
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: So 13.11.05 18:57 
eleganter siehts wahrscheinlich so aus:
ausblenden Delphi-Quelltext
1:
2:
{OnCloseQuery}
CanClose := MessageBox(0, 'Wirklich beenden?', 'Bestätigung', MB_YESNO or MB_ICONQUESTION) = id_yes;


mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: So 13.11.05 19:00 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Button1Click(Sender: TObject);
var
  i: integer;
begin
  i := Messagebox(Handle, 'TEXT', 'ÜBERSCHIFT', MB_YESNO or MB_ICONQUESTION {Falls du noch so ein Frageicon willst});
  if i := 6 {YES = 6} then // mach was
end;


greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.