How do I know that the console application does not respond?

delphi package - easy access to kernel objects etc.

How do I know that the console application does not respond?

Postby Ahell » Sun May 15, 2011 7:40 pm

Good day!

Interested in the following question:
How do I know when the console does not work?
Suppose I create a console application:
Code: Select all
program hung;

{$APPTYPE CONSOLE}

begin
  while true do;
end.


And the program is as follows:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
const
  Prc='hung.exe';
begin
  Process(Prc).ServiceProcess:=True;
  if Process(Prc).IsStillRunning then
    ListBox1.Items.Add('IsStillRunning = True')
  else
    ListBox1.Items.Add('IsStillRunning = False');

  if Process(Prc).IsStillValid then
    ListBox1.Items.Add('IsStillValid = True')
  else
    ListBox1.Items.Add('IsStillValid = False');
  if Process(Prc).IsValid then
    ListBox1.Items.Add('IsValid = True')
  else
    ListBox1.Items.Add('IsValid = False');
end;


All functions have returned result TRUE :sorry:

Generally there is a way of catching these problems? How do I know that the console application hangs (not responding)?

I have a lot of which asked this question, but I think you'll be able to answer it because I think that you are most know of these mechanisms work windows.

Thanks in advance!

P.S. Text translated by Google Translator. (Not so well know English).
Ahell
 
Posts: 31
Joined: Mon Feb 07, 2011 4:54 pm

Re: How do I know that the console application does not resp

Postby madshi » Mon May 16, 2011 7:35 am

I don't think there's any way to know.

With a GUI application, every thread which has a visible window open needs to react to messages. Without that the windows will appear dead and the OS will consider the application "hung" (not responding). With console applications, the console window itself is handled by the OS. None of the threads of a console application is required to handle any messages. So there's no way from the outside to know whether a console application is "hung" or whether it's simply busy doing something.
madshi
Site Admin
 
Posts: 9265
Joined: Sun Mar 21, 2004 5:25 pm

Re: How do I know that the console application does not resp

Postby Ahell » Mon May 16, 2011 12:30 pm

So sorry that no way to test the console application to hang.
Look for other ways to, well, or an alternative ...

Thank you for your reply.
Ahell
 
Posts: 31
Joined: Mon Feb 07, 2011 4:54 pm


Return to madKernel

Who is online

Users browsing this forum: No registered users and 1 guest

cron