: : : : : : : Hi All
: : : : : : :
: : : : : : : with execution of window dialog boxes such as print dialog
: : : : : : : or
: : : : : : : [Messagedlg('My Error Message',mtError , [mbOk], 0);]
: : : : : : : or
: : : : : : : when goto one menu of TMainMenu
: : : : : : :
: : : : : : : the application freeze. in fact, while the dialog/menu window exists, no other procedures and timers and loops work and all things stop.
: : : : : : :
: : : : : : : how can i overcome this problem?
: : : : : : :
: : : : : : : I use Delphi5 on WinXP
: : : : : : :
: : : : : : : regards
: : : : : : :
: : : : : : :
: : : : : : I've never heard of this problem, perhaps you should post some code around the calls, so we can see if the code after the dialog doesn't freeze.
: : : : : :
: : : : :
: : : : : procedure InitializeHardware();
: : : : : var
: : : : : tr: integer;
: : : : : success: boolean;
: : : : : label
: : : : : again;
: : : : : begin
: : : : : tr:=0;
: : : : : again:
: : : : : success:=true;
: : : : : if SetTimer1Device11(round(formre.rxspinedit34.value),1)<>100 then
: : : : : begin
: : : : : success:=false;
: : : : : inc(tr);
: : : : : if tr<trynumber then goto again;
: : : : : MessageBeep($FFFFFFFF);
: : : : : formse.EventLoggerText('>Can not Set Refrence Time!');
: : : : : if not IgnoreErrors then
: : : : : if MessageDlg('Can not Set Refrence Time! Try Again?',mtError ,
: : : : : [mbOk, mbCancel], 0) = mrOk then
: : : : : begin
: : : : : goto again;
: : : : : end;
: : : : : end
: : : : : else
: : : : : begin
: : : : : formse.EventLoggerText('> Set Refrence Time.');
: : : : : end;
: : : : : formre.GetMaxCapVolt();DoTrigChargeControl:=true;
: : : : : if success then formse.ProcessLoggerText('> Initialize Hardware.');
: : : : : end;
: : : : :
: : : : In this case you have created a nice long loop. Since a single-threaded program can only run 1 loop at the time, and this loop runs, all other loops will not run. Only events based on application messages will run, because during the display of the message dialog, messages are handled by the application.
: : : : You should either make your program into a multithreaded one, or rely on TTimer components or on WaitForSingleObject() API function to run the steps of your loops.
: : : :
: : : OK, Tanx
: : : I found in my application that Application.HandleMessage; or Application.ProcessMessages; command in other loops produce this problem.
: : : I cannot delete/replace this commands. what is solution?
: : :
: : :
: : Then I only see one other solution: Redesign your program into a multithreaded application.
: :
: :
: because of large of components, control and forms, its difficult for me to do it, soon.
:
:
I try both in Delphi and C++Builder,
when do right mouse click and down key. all things stop and application freeze. what is it?