Peter Kiers
asked on
How to get the icon on the messagebox?
Dear Experts,
I have put a picture of a messagebox of another application as attach.
I want to make the same messagbox for my application.
I got everything the same (see the procedure in the code-section) except for the icon.
How could I do that?
Greetings, Peter Kiers
I have put a picture of a messagebox of another application as attach.
I want to make the same messagbox for my application.
I got everything the same (see the procedure in the code-section) except for the icon.
How could I do that?
Greetings, Peter Kiers
procedure TForm1.DeleteButtonClick(Sender: TObject); var
node : TTreeNode;
mess, str : string;
key_stat : integer;
begin
Node := Treeview1.Selected;
if Assigned(Node) then
begin
str := Node.Text;
mess := 'Are you sure that you want to delete the';
Case Node.ImageIndex of
15 : mess := mess + ' folder ' + '"' + str + '"?' +#13+
'All folders, subfolders, items and subitems will be permanently' +#13+ 'deleted.' +#13;
17 : mess := mess + ' item ' + '"' + str + '"?' + #13;
end;
with Application do
begin
NormalizeTopMosts;
key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO);
RestoreTopMosts;
end;
if key_stat = 7 then Exit;
TreeView1.Items.Delete(Treeview1.Selected);
end
else ShowMessage('Select a folder in the treeview first.');
end;
Use Message Dialog instead
MessageDlg('Confirm Deletion', mtInformation, mbYesNo, 0)
Regards,
B.
MessageDlg('Confirm Deletion', mtInformation, mbYesNo, 0)
Regards,
B.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I guess i have to change:
key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO);
into:
key_stat := MessageDlg <====could you help me with the rest?
Greetings, Peter Kiers
key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO);
into:
key_stat := MessageDlg <====could you help me with the rest?
Greetings, Peter Kiers
ASKER
I get error message:
Incompatible types: integer and PAnsiChar
PK.
Incompatible types: integer and PAnsiChar
PK.
ASKER
I have made this, is this good programming because it sure works.
key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO + MB_ICONIFORMATION);
Peter
key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO + MB_ICONIFORMATION);
Peter
ASKER
FactorB: 500 points comming your way...
Greetings
Peter Kiers
Greetings
Peter Kiers
yes it is works for me too, later you can use
key_stat := MessageBox(0, PChar(mess), PChar('Confirm Deletion'), MB_YESNO + MB_ICONINFORMATION);
if key_stat=7 then Exit; {7=NO}
if key_stat=6 then TreeView1.Items.Delete(Tre eview1.Sel ected); {6=YES}
Thanks, hope it helped,
B.
key_stat := MessageBox(0, PChar(mess), PChar('Confirm Deletion'), MB_YESNO + MB_ICONINFORMATION);
if key_stat=7 then Exit; {7=NO}
if key_stat=6 then TreeView1.Items.Delete(Tre
Thanks, hope it helped,
B.
ASKER
Example1.bmp