Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 20.04.03 11:26 
Hallo,

Ich versuche ein kleines Program zu schreiben das sehr gut klappt.

Ich habe alle uses rausgelöscht auch forms.

Nur benötige ich jetzt eine MessageDLG mit ja, nein abfrage.

Wo er bei nein exit;

Eine andere Möglichkeit von einer MessageBox?
Habe uses:
Windows, classes, shellapi

Danke..
Lehrling
Hält's aus hier
Beiträge: 7



BeitragVerfasst: So 20.04.03 11:33 
Hallo,

Aus der WindowsSDK (Begriff: "MessageBox")
Zitat:
int MessageBox(

HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);



mfg Lehrling
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 11:36 
Zitat:
MessageBox(form1.Handle,PChar('Ja oder Nein'),PChar('Test'),MB_YESNO);
Hilft das?

Rückgabewerte sind dann IDYES oder IDNO.

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 11:36 
Schon wieder zu langsam...

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: So 20.04.03 12:09 
Peter Lustig hat folgendes geschrieben:
Zitat:
MessageBox(form1.Handle,PChar('Ja oder Nein'),PChar('Test'),MB_YESNO);
Hilft das?


Wobei dur dir das PChar (solange du keine Variablen vom Typ String mit einbeziehst) sparen kannst.

Das würde dann so ausssehen:

ausblenden Quelltext
1:
MessageBox(form1.Handle,'Ja oder Nein','Test',MB_YESNO);					


Grüße
Florian :roll:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 12:42 
Ups, stimmt. :oops:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 20.04.03 14:21 
Und TApplication kennt die Methode Messagebox. :wink:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 14:22 
Ja, aber dazu brauchst Du doch die Unit "Forms" und die hat er - wie er sagt - nicht eingebunden!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 20.04.03 14:25 
Ich bin noch nicht wach und habe noch nichts gegessen. Reicht das als Entschuldigung? :oops:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 14:26 
Du bist hiermit offiziell entschuldigt!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: So 20.04.03 14:26 
*LuckieWachRüttel*

:mahn:

:lol:
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 20.04.03 17:47 
Hallo,

Vielen Dank.

Ja MessageBox hat geholfen.
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 20.04.03 17:49 
Titel: PChar -> String ; String -> PChar
Hallo,

Wie kann ich einen PChar Wert in einen Stringwert oder Integer Wert umwandeln.

Danke
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 20.04.03 17:52 
PChar nach String brauch in der Regel nicht umgewandelt werden, das macht der Kompiler.- Will man es aber sauber machen, macht man einen Cast mit String. PChar nach Interger wie bei Strings auch mit StrToInt und eben noch voreher einen cast mit String.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 17:55 
Hm, Casting-Shows jetzt auch schon im Delphi-Forum? (okay, der war wirklich schlecht, ich weiß ...)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 20.04.03 17:57 
Peter Lustig hat folgendes geschrieben:
Hm, Casting-Shows jetzt auch schon im Delphi-Forum? (okay, der war wirklich schlecht, ich weiß ...)

Aber unterstes Niveau. Da ist ja selbst noch
Zitat:

Ich mache jetzt keinen Kalauer, da kannst du warten bis du kahl wirst.

besser. :mrgreen:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.04.03 17:59 
Aber nur ein ganz kleines bisschen! :lol:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
shrubman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Sa 20.11.04 12:18 
Ich versuche grad mit einer Message Box zu arbeiten aber bekomme das mit der Delphi Hilfe nicht richtig hin ...
Was ist hier dran falsch :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_YESNO): Integer;
begin
if IDYES=true
then
begin
showmessage('SEX');
end
else
showmessage('ALKOHOL');
end;
shrubman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Sa 20.11.04 12:31 
ich habs überarbeitet
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
if
Length(Label1.Caption)=Length(Wort)
then
begin
with application do begin
    NormalizeTopMosts;
    MessageBox('Restart program?''Look', MB_YESNO);
    RestoreTopMosts;
    if
    IDYES=true
    then
    begin
    WinExec(pChar(ParamStr(0)),SW_SHOW);
    Close;
    end else close;
end;
end;

aber bei IDYES=true sagt er inkompatible typen
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Sa 20.11.04 12:55 
MessageBox gibt dir als Rückgabewert IDYes/IDNo. Das hast du im Code nicht zugewiesen!!

Also
ausblenden Quelltext
1:
2:
3:
if MessageBox(Handle,'Restart program?', 'Look', MB_YESNO)=IDYes then 
begin 
end;