Solved

Application process not terminating on Win2000

Posted on 2003-10-29
11
225 Views
Last Modified: 2010-04-05
Does anyone know of any reason why an application process written with delphi6 will not terminate correctly? It uses the BDE to access Paradox tables and does not use any threads.
The problem only occurs on certain Win2k machines, but does not display any error message. We do use the OneInst.pas unit which uses a mutex to prevent multiple instances of the application from running. This results in the user having to manually kill the process before the app can be re-run.

Thanks

Jo Beaven
CharitySoftware Ltd
0
Comment
Question by:nnbbb09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
11 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9643151
procedure TFormMain.FormDestroy(Sender: TObject);
begin
  while True do begin
    Application.ProcessMessages;
  end;
end;
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9643178
The code is an example how it can occur.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9643197
So check all functions like OnDestroy, OnClose, ... and make sure that you stop all timers.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:nnbbb09
ID: 9648672
All timers are definitely stopped. It seems like a Win2000 permissions problem. If the application is run with admin rights then the problem does not occur.
0
 
LVL 17

Expert Comment

by:geobul
ID: 9648734
Hi,

Try without mutexes this way:
---
give your main form a Custom Class name and do FindWindow for that Class name.

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

begin
  if FindWindow('I Am Mostly Asleep', nil) <> 0 then exit;

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

and in your main form's code -

 protected
 { Protected declarations }
   procedure CreateParams(var Params: TCreateParams); override;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WinClassName := 'I Am Mostly Asleep';
  {set your Form's Class Name to a UNIQUE and UNCOMMON string, Like Drt45v6Z2}
end;

Regards, Geo
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9649200
By the way how many threads the Task Manager show for your program when it is gone to background?

>If the application is run with admin rights then the problem does not occur.
It's rather strange. Can you find the problem code in debugger, going step-by-step?
0
 
LVL 3

Author Comment

by:nnbbb09
ID: 9672094
I can't recreate the problem on the machines here, it only seems to occur on customer machines. I can't see the number of threads per process only the total running for the operation system.

As I said earlier it looks like a permissions problem as it doesn't occur for someone with admin rights. Any idea what kind of permissions I could set on my PC to replicate this problem.

Thanks
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9672841
>As I said earlier it looks like a permissions problem
May be it's a permissions problem but "locally".
In "global" it means (imho) that there is some kind of infinite cycle occur when the application stop.
Add to the application some kind of logging to find the problem code.
0
 
LVL 3

Accepted Solution

by:
nnbbb09 earned 0 total points
ID: 9694657
After much debugging of the VCL it seems the DBIExit called from the Finalization section of DBTables was causing the problem. Apparently this forces the BDE to write changes to HKEY_LOCAL_MACHINE\Software\Borland (which the user doesn't have access to) hence the application hangs.

I used regedt32 to grant access to that key and it works fine now.
0
 
LVL 3

Author Comment

by:nnbbb09
ID: 10275110

I'm going to ask Support to PAQ this as I answered it myself. Any objections, please list them here.

Thanks

Jo
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 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