Solved

How to get the icon on the messagebox?

Posted on 2009-07-15
8
228 Views
Last Modified: 2012-05-07
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
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;

Open in new window

0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 1

Author Comment

by:peterkiers
ID: 24866691
forgot the picture.
Example1.bmp
0
 
LVL 6

Expert Comment

by:FactorB
ID: 24867081
Use Message Dialog instead

MessageDlg('Confirm Deletion', mtInformation, mbYesNo, 0)

Regards,
B.
0
 
LVL 6

Accepted Solution

by:
FactorB earned 500 total points
ID: 24867152
No, better use MessageBox API function and change it this way,

key_stat := MessageBox(0, PChar(mess), PChar('Confirm Deletion'), MB_YESNO + MB_ICONINFORMATION);

Regards,
B.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:peterkiers
ID: 24867160
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

0
 
LVL 1

Author Comment

by:peterkiers
ID: 24867189
I get error message:

Incompatible types: integer and PAnsiChar

PK.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24867228
I have made this, is this good programming because it sure works.

key_stat := MessageBox(pchar(mess), 'Confirm Deletion', MB_YESNO + MB_ICONIFORMATION);

Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24867250
FactorB: 500 points comming your way...

Greetings
Peter Kiers
0
 
LVL 6

Expert Comment

by:FactorB
ID: 24867263
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(Treeview1.Selected); {6=YES}

Thanks, hope it helped,
B.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question