Question Disabling Close window option in windows 7

Developer111

Member
Joined
Apr 21, 2010
Messages
24
Programming Experience
5-10
I have an application developed in VB.net with 3.5 framework. I have disabled close (X) button on the main form of the application while doing some processing. I have achieve disabling by "Overriding ReadOnly Property CreateParams()" of the form. This is working fine as both control button on form and close option on right click in the taskbar shows disabled. This fulfill my needs on the Windows XP OS but not on Windows 7 OS. As in Windows 7 right click on application icon in taskbar shows a different menu, which has a new "Close window" option.

The close in original menu still shows disabled (this old menu is hidden but can be shown by holding Shift key and right click on the application icon in taskbar). Now I need to disable this "Close window" option as well and only for my application.

Is there a method through which I can do this programmatically. Also please let me know about any other solutions.

Regards,

Hassan
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,493
Location
Sydney, Australia
Programming Experience
10+

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,545
Location
Norway
Programming Experience
10+
Wouldn't be better to handle FormClosing event, inform user about 'still processing' and give option to resume or abort processing and close? After all, it was user that initiated processing and user may want to stop both processing and close the app at any time.
 

Developer111

Member
Joined
Apr 21, 2010
Messages
24
Programming Experience
5-10
I tried to use Windows API Code Pack but it provide options to add new categories and links, but by default "Close window" option is there. can you provide me help in using them
 
Top Bottom