Link to home
Start Free TrialLog in
Avatar of peat042998
peat042998

asked on

Catch the calls

Can anyone please tell me how to do two things the first is :- the code or a way to catch the call that stops the user from closing you app with ctrl-alt-delete, not disable ctrl-atl-delete.

The second is catch the call to stop a program closing when the log-off option is used, the user should be able to log-off but the program should not close.

Hope you can help, Peat.
Avatar of anthonyc
anthonyc

HAHAHAHHAHAHAHHAHAH for 25 points too.. of course.
What you need to stop the user from closing your app is in the QueryUnload event of your form:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

  If UnloadMode = vbAppWindows Or UnloadMode = vbAppTaskManager Then
    Cancel = True
  End If
End Sub

The second option isn't possible.
Avatar of peat042998

ASKER

anthonyc : it looks like you know the answer, 25 points was all I had when I posted the question.  I can up it to 100 if you can give an answer that works.  

And if you or anyone else have answers for both parts (answers that work) I will up the points to 150.

Another way which could answer part of this question is not to catch the call for the C-A-D but to take my apps entry alway from the C-A-D list.

I still need to know how to catch the call to stop a program closing when the log-off option is used, the user should be able to log-off but the program should not close.

This is very important and needed quickly the first person to give the answers that that work will get the points.

Thanks and I hope someone can help.
sorry clifABB that didn't work.
ASKER CERTIFIED SOLUTION
Avatar of bernfarr
bernfarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might also find the article:
  http://support.microsoft.com/support/kb/articles/q114/7/76.asp

It shows how to hide a VB program from the task list.