?
Solved

Error logout/shutdown Windows NT 4

Posted on 2001-07-13
8
Medium Priority
?
194 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 100 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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…
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 Month15 days, 4 hours left to enroll

770 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