Solved

Error logout/shutdown Windows NT 4

Posted on 2001-07-13
8
192 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
[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
  • 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
Industry Leaders: 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!

 

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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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