Solved

Error logout/shutdown Windows NT 4

Posted on 2001-07-13
8
190 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree add node to another virtuailstring tree list 4 115
Working with hours 3 58
how can i search if string exist in array ? 3 59
Dynamically Created Query 3 56
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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