Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Customize Message Dialog ?

Posted on 2004-10-05
4
Medium Priority
?
471 Views
Last Modified: 2010-04-05
hey,
Is it possible to customize the message dialog without using any component?

can i create a new button for the message dialog? if is possible, how can i do it.

thanks
josh
0
Comment
Question by:joshfly
[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
4 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 12234776
You could use your own message dialog derived from the original one, but customized.
Something like:

function MyMessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons) do
  begin
    try
      HelpContext := HelpCtx;
      Color := $00A2EAB0;
      Result := ShowModal;
    finally
      free;
    end;
  end;
end;
0
 
LVL 1

Expert Comment

by:Bart_Thomas
ID: 12241532
Another way is to use the Windows MessageBox. It is possible to customize it through a "trick".
You post a user-message and in its hander you can change caption, buttoncaption, etc:

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    procedure WM_Hack (var message: TMessage); message WM_USER + 1025;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  PostMessage (Handle, WM_USER + 1025, 0,0);
  MessageBox (Handle, 'Test', 'MyApplication', MB_OKCANCEL or MB_ICONINFORMATION);
end;

procedure TForm1.WM_Hack(var message: TMessage);
var
  h: HWND;
begin
  h := FindWindow (WC_DIALOG, 'MyApplication');
  if GetParent (h) = Handle then
  begin
    SetDlgItemText (h, ID_OK, '&Login');
    SetDlgItemText (h, ID_CANCEL, '&Cancel');
  end;
end;
0
 
LVL 2

Accepted Solution

by:
-Karamja- earned 200 total points
ID: 12241638
0
 

Author Comment

by:joshfly
ID: 12256014
Thanks ! -Karamja-
that's what i want.

thanks
josh
:)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

715 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