Can´t Exit Windows while my program is running.

I made a port blocker that is autostarted with windows, but every time I want to exit windows i must close my program. Why? How do I fix it?
SwOoPeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
Hi
add this to your program:

    procedure WMQueryEndSession(var Msg: TWMQueryEndSession) ;
      message WM_QUERYENDSESSION ;


procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
const
  CAN_SHUTDOWN = 0 ;
  DONT_SHUTDOWN = 1 ;
begin
  inherited ;
  if something then { something can be a glabal boolean or comment out the line}
    Msg.Result := CAN_SHUTDOWN
  else {either comment this out or use with the global boolean}
    Msg.Result := DONT_SHUTDOWN ;
end;


Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SwOoPeAuthor Commented:
I haven´t tryed it yet but thanks for your reply.

David
0
SwOoPeAuthor Commented:
damm inthe it diden´t work. Do u have any other solotions to this problem?

Can be becouse I use:

procedure WndProc(var Msg : TMessage);

for a tray icon?
0
intheCommented:
for a start try commenting out all the tray icon code(as far as im aware these are the 2 most normal faults for this problem is tray icon and wm_queryendsession).
see if it works then
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.