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

add this to your program:

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

procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
  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 ;

Regards Barry

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.

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

From novice to tech pro — start learning today.