ShowMessage

Hi.

I want to show a message when a proc starts and then terminate it when the calculation end.
(form is hidden)
How can i show a message without the ok button and then kill it ?
LVL 16
CodedKAsked:
Who is Participating?
 
ginsonicConnect With a Mentor Commented:
Show message with:

MessageDlg('I wish to do something in this time!', mtWarning, [], 0);

when all is done then close with:
var wh:HWND;
begin
  wh:=FindWindowByTitle('Warning');
  PostMessage (Wh, WM_CLOSE, 0, 0);
end;

the function for FindWindowByTitle is:

function TForm1.FindWindowByTitle(WindowTitle: string): Hwnd;
var
  NextHandle: Hwnd;
  NextTitle: array[0..260] of char;
begin
  NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
  while NextHandle > 0 do begin
    GetWindowText(NextHandle, NextTitle, 255);
    if pos(WindowTitle, StrPas(NextTitle)) <> 0 then
    begin
      result := NextHandle;
      exit;
    end else
      NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
  end;
  result := 0;
end;
0
 
Tomas Helgi JohannssonCommented:
    Hi!
Why don't you create a Form displaying the message in a Label
Displaying and hiding form is easy ;)

Regards,
  Tomas Helgi
0
 
atul_parmarCommented:
Another reason to go with TomasHelgi is that the ShowMessage and MessageDlg are modal, so until it is terminated, it won't execute the next line of code. So, even if you use your form to display the msg, it should be modalless.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
CodedKAuthor Commented:
Hi, thanks for the replys.
If there is no other way to handle the message of course i'll have to use the form...
I was thinking if someone has a source or a customized message dialog that can accept commands.

0
 
ginsonicCommented:
MessageDlg('Welcome!', mtCustom, [], 0) ;
0
 
CodedKAuthor Commented:
Thank you GinSonic :)
0
 
ginsonicCommented:
My pleasure!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.