Hiding "close window" button on taskbar

G

Giovanni1980

Hi, I need to hide (or disable) the "close window" option showed when you right click on the application's icon, in the windows 7's taskbar.
Any idea??
Tnx, Giovanni
 
A

Anders Eriksson

G

giovannigambino1980

Tnx for answer Anders. Unfortunately the requirement is to show the icon and hide the button.
I was looking a "dirty way" customizing the thumbnail menu showed by the taskbar... I've seen in some example that is possible to hide that button.
 
J

Jeff Johnson

Tnx for answer Anders. Unfortunately the requirement is to show the icon
and hide the button.
I was looking a "dirty way" customizing the thumbnail menu showed by the
taskbar... I've seen
in some example that is possible to hide that button.

Main question: Are you in control of the code of the program that you don't
want to be closed? In other words, can you change the code of the program?

If you CAN change the code, then this sounds like a situation where a
particular effect is desired and someone has focused on a particular METHOD
of achieving that effect instead of attempting to solve the problem in
whatever way works.

In this case, instead of making the requirement "We don't want the user to
close the program," instead the requirement has become "We want to remove
Close from the system menu." I would say just intercept the FormClosing
event and check the CloseReason property of the event args parameter. If
it's UserClosing, just set the Cancel property to true and the form will not
close. (Checking the close reason will allow the form to close if Windows is
being shut down, for example, and will not make you force close the app.)

If, on the other hand, this is some 3rd-party app that you're trying to run
in "kiosk" mode, well, good luck. This sort of cross-process tampering was
available a long time ago, but more and more safeguards have been put in
place as Windows has evolved to prevent apps from modifying other apps in
this manner, and fiddling with an application's system menu is going to be
difficult if not impossible under modern Windows OSes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top