Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
application freeze problem with dialog Posted by john111smith on 16 Jan 2007 at 3:54 AM
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

Report
Re: application freeze problem with dialog Posted by zibadian on 16 Jan 2007 at 1:49 PM
: 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.
Report
Re: application freeze problem with dialog Posted by john111smith on 16 Jan 2007 at 11:33 PM
: : 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;
Report
Re: application freeze problem with dialog Posted by zibadian on 17 Jan 2007 at 12:43 AM
: : : 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.
Report
Re: application freeze problem with dialog Posted by john111smith on 17 Jan 2007 at 4:45 AM
: : : : 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?



Report
Re: application freeze problem with dialog Posted by zibadian on 17 Jan 2007 at 4:49 AM
: : : : : 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.

Report
Re: application freeze problem with dialog Posted by john111smith on 17 Jan 2007 at 4:55 AM
: : : : : : 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.

Report
Re: application freeze problem with dialog Posted by john111smith on 17 Jan 2007 at 5:37 AM
: : : : : : : 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?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.