?
Solved

How to get the icon on the messagebox?

Posted on 2009-07-15
8
Medium Priority
?
231 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 2000 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
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!

 
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

762 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