Solved

Error logout/shutdown Windows NT 4

Posted on 2001-07-13
8
189 Views
Last Modified: 2010-04-06
Hello,

If i run my Delphi program, windows(NT4 server/workstation) is unable to logout a user or to shutdown..!! All open programs will be closed except mine. When i manually close my program everything works fine.. Does anyone have an idea whats going wrong?

If you need more info let me know..!!

Thanks,

Vincent
0
Comment
Question by:Vincentg
  • 4
  • 3
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6280126
have you assigned a procedure on any forms-onclosequery event in your app, where allow-close is set to false?
0
 

Author Comment

by:Vincentg
ID: 6280156
I only use :

Procedure Tform1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action := CaNone;
Form1.hide;
end;

I already tried without this but the result is the same..!!

0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 6280165
try listebning for WM_QUERYENDSESSION by adding this to your form:

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
   procedure WMQueryEndSession(var Msg: TWMQueryEndSession) ; message WM_QUERYENDSESSION ;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  ok_to_close : boolean;

implementation

{$R *.DFM}

procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
const
  CAN_SHUTDOWN = 0 ;
  DONT_SHUTDOWN = 1 ;
begin
  inherited ;
  if ok_to_close then {ok_to_close is the global boolean}
  Msg.Result := CAN_SHUTDOWN
  else {if ok_to_close has been set to false then we would get here}
    Msg.Result := DONT_SHUTDOWN ;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ok_to_close := true;
end;
0
 

Author Comment

by:Vincentg
ID: 6285077
He,

Thanks for replying, i intergrated your code in my program
but it still doesn't work. I don't understand why it is't close down when shutting down windows. Any other suggestion? if you need more info just let me know..

Thanks,
Vincent
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:inthe
ID: 6286822
add a showmessage after in the WMQueryEndSession to see if your apps even getting the message.


kind of a last resort but one to try is to make a copy of your project and start deleting stuff until it works .

ps,
does it work on new blank project on your system?
if so it must be something in your code somewhere thats not letting go.
0
 

Author Comment

by:Vincentg
ID: 6287223
He,

Thanks for replying, i intergrated your code in my program
but it still doesn't work. I don't understand why it is't close down when shutting down windows. Any other suggestion? if you need more info just let me know..

Thanks,
Vincent
0
 
LVL 17

Expert Comment

by:inthe
ID: 6331770
only other idea is to assign one of these as meikl was mentioning "forms-onclosequery" and set canclose to true;
0
 

Author Comment

by:Vincentg
ID: 8172031
for trying ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using FastMM4... should I enable MMX option? 9 76
Delphi application Soap connection 5 96
Delphi XE10 Round Image 2 78
find a node in VST 2 64
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now