Windows Develop Bookmark and Share   
 index > Windows Forms General > Setting the ControlBox property to false has no effect on Windows 7 taskbar!
 

Setting the ControlBox property to false has no effect on Windows 7 taskbar!

Hello,

Setting the ContolBox property to false has no effect on Windows 7 taskbar, so when you right click on the application inside the taskbar, it shows the "Close Window" menu item!

This doesnt happen in vista nor XP

So is this bug or what?

Thanks.
Yazeed Hamdan  Tuesday, October 06, 2009 11:13 AM

it was prior windows 7 (XP and vista disables the close menu item if you set the controlBox to false and also you can accomplish it by using Win32 APIs directly), i have an application where every possible way to terminate the application is disable, the only way to terminate the application is go through it till the end (even restart/shutdown/logOff are disabled from the domain controller), if an error occured, the application will be closed by itself, everything is handled, i dont know why microsoft changed this behavior!!!

No straight way worked starting from Win32 APIs to managed code, the only way to accomplish this is to override FormClosing event. so now i have to go through all forms and override this method!!

I would still believe this is a bug not a feature, as when you kill the process from taskManager, it will terminate the application immediately and stop code execution, but when you select close , the code keeps running to perform the closing events.

And no, the user shouldnt always be in control of his machine, consider an application which are doing major things to the fileSystem Or registry, terminating it in the middle of any operation will lead to major System failure.

Yazeed Hamdan  Tuesday, October 06, 2009 9:02 PM
It is a feature.  Saves the user from having to use Taskmgr.exe

Hans Passant.
nobugz  Tuesday, October 06, 2009 12:45 PM
so basically you cant prevent the closing of any application in windows 7? how bad this feature is.

Is there anyway to disable it via Taskbar APIs?

Thanks
Yazeed Hamdan  Tuesday, October 06, 2009 5:50 PM
What makes you think this is possible?  The user is in control of her machine, not you.  You'll need to get used to that.  If you want to prevent accidental termination, consider using a service instead.

Hans Passant.
nobugz  Tuesday, October 06, 2009 7:38 PM

it was prior windows 7 (XP and vista disables the close menu item if you set the controlBox to false and also you can accomplish it by using Win32 APIs directly), i have an application where every possible way to terminate the application is disable, the only way to terminate the application is go through it till the end (even restart/shutdown/logOff are disabled from the domain controller), if an error occured, the application will be closed by itself, everything is handled, i dont know why microsoft changed this behavior!!!

No straight way worked starting from Win32 APIs to managed code, the only way to accomplish this is to override FormClosing event. so now i have to go through all forms and override this method!!

I would still believe this is a bug not a feature, as when you kill the process from taskManager, it will terminate the application immediately and stop code execution, but when you select close , the code keeps running to perform the closing events.

And no, the user shouldnt always be in control of his machine, consider an application which are doing major things to the fileSystem Or registry, terminating it in the middle of any operation will lead to major System failure.

Yazeed Hamdan  Tuesday, October 06, 2009 9:02 PM

You can use google to search for other answers

Custom Search

More Threads

• Authentication with a WebService through WindowsForms
• wrong window styles after upgrading to vs 2008
• HTTP_USER_AGENT header when navigating to a URL through the CAtlHttpClient
• CPU utilization using wmi..
• Identifying open windows
• Timer Residual WM_TIMER
• Problem with GridView bound to Stored Procedure
• Multiple Buttons Using One Button_Click Event Method
• MessageBoxIcon on Dialog Box
• toolstripmenu addrange problem