?
Solved

Application process not terminating on Win2000

Posted on 2003-10-29
11
Medium Priority
?
226 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Technology Partners: 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

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 tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 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