Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get the icon on the messagebox?

Posted on 2009-07-15
8
Medium Priority
?
232 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
Technology Partners: 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

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!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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