Solved

MessageDlg Not Performing Correctly

Posted on 2003-12-10
2
345 Views
Last Modified: 2012-05-04
I have an application with numerous forms.  On some forms when I use the messagedlg function, message box does not appear but the system is still waiting for a response so the application is frozen because I can not give it a response.  Does anyone know why this may be happening and why on some forms in the application but not others?
0
Comment
Question by:mcmahling
2 Comments
 
LVL 5

Accepted Solution

by:
delphized earned 250 total points
ID: 9916822
messagedlg actually create a runtime delphi tform and populate with components, and then make a showmodal.
there is no particular reason to froze the application. (but do you use some secondary threads?)
Normally I use windows.messagebox that is a call to a window API function and is more stable.
you can try with it:

  MessageBox(self.handle,
             'Hello',
             PChar(Application.title),
             MB_OK or
             MB_ICONINFORMATION or
             MB_APPLMODAL);

you can also use application.messagebox, in which there is a call to windows.messagebox, but it's surrounded with delphi code. It's you choice.

in both cases I think it's better that messagedlg.
0
 

Expert Comment

by:songhd
ID: 9917871
I think some wrong with your application,some fatal wrong  code after the showmessage.Today I happened to meet it.I use AdoQuery to find the record,before this I use showmessage,but the messagebox did not exist ,the system is still waiting for a response so the application is frozen.
Now code is :
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('hi');
while not AdoQuery2.Eof do
begin
if Edit1.Text=AdoQuery2.FieldByName('name').AsString then Have:=True;
//Now, I find out that I lost the AdoQuery2.Next code.
end;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

912 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now