473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Disable Windows Close Button

Hi
How do i disable windows close button in forms in C#

Regards
Saurabh
Nov 16 '05 #1
3 6116
Actually, you cannot disable it. What you can do is, place an image over the
button to hide it ( and do nothing when the image is clicked)

Ranjan
--
http://dotnetjunkies.com/weblog/dotnut


"Saurabh Sharma" <sa***********@yahoo.com> wrote in message
news:#b**************@tk2msftngp13.phx.gbl...
Hi
How do i disable windows close button in forms in C#

Regards
Saurabh

Nov 16 '05 #2
You said the same thing I was thinking of when you mentioned the bool.
You also might be able to test the value of the sender and compare it
to something to see where it came from and decide what to do. I cant
think of anything thats just a single click. You would think something
that simple would be in there. Keep us updated.

Nov 16 '05 #3
Hello

[DllImport("user32.dll")]
private static extern int GetSystemMenu(int hwnd, int revert);

[DllImport("user32.dll")]
private static extern int GetMenuItemCount(int menu);

[DllImport("user32.dll")]
private static extern int RemoveMenu(int menu, int position, int flags);

protected void DisableCloseButton()
{
int menu = GetSystemMenu(Handle.ToInt32(), 0);
int count = GetMenuItemCount(menu);
RemoveMenu(menu, count - 1, MF_DISABLED | MF_BYPOSITION);
}

Aleksandar

"Saurabh Sharma" <sa***********@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi
How do i disable windows close button in forms in C#

Regards
Saurabh

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: lori3laz | last post by:
How do you disable the right click>view source option on web pages so people can't view your coding and copy it? What's the html I need to include in my website to utilize this feature? Thank...
3
by: bobdydd | last post by:
Hi Everybody On Report Preview Does anyone know of a way to disable the Minimum, Maximum and Close buttons, so that the user cannot close by any other means that the Toolbar button that I have...
24
by: Agnes | last post by:
I need to disable the exit button in the form . However, the min. and max. button need to keep it How ? Thanks a lot From Agnes
12
by: Mika M | last post by:
Customer wants the Close (X)-button of the forms top right corner to be Disabled or removed from Windows Form-application, which is made using VB.NET, but leave MinimizeBox and MaximizeBox. I...
0
by: JP | last post by:
Is there a way to temporirly disable the X button (close) on a MODAL window in the web browser? We have cleanup code that needs to run after the user closes the modal window. This works fine if the...
2
by: ohadasor | last post by:
Hello, I have an MDI child, which I need to be opened as long as the mainframe is opened. The problem is that the user can close it using the X button in the form's top-right edge. How can I...
3
by: Richard Lewis Haggard | last post by:
Is there an easy way to disable the hotkey sequence Control F4 or otherwise prevent the action from killing off MDI child windows in VS05/WinForms 2? I've already figured out how to get rid of the...
4
by: mhifd009 | last post by:
I have disabled a close button in the property section of a form (FRM1), as i open the form the close button has gone (i have programmed close button), but as i close the form, the form that opened...
3
by: Donald A. Fisher | last post by:
Hello. I've been working a vb project and have a form with a button on it that performs some actions after disabling the button when clicked: Code disabling button and starting actions: Private...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.