Solved

MessageDlg Not Performing Correctly

Posted on 2003-12-10
2
343 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

18 Experts available now in Live!

Get 1:1 Help Now