Disable MessageBox Close[X] in C#

Posted by Naraayanan under C# on 7/19/2012 | Points: 10 | Views : 9898 | Status : [Member] | Replies : 6
Hi,
I am using MessageBox in Project.How to disable MessageBox Close[X] button ?
My MessageBox like this:
MessageBox.Show("Are you sure, Do you want to Close this Application?","Application Name",MessageBoxButtons.Ok );

How to disable MessageBox Close[X] button.
Note:I know, It is possible in MessageBoxButtons.YesNo display button.I know you can create a Custom MessageBox .My Question is why is not possible to MessageBoxButtons.Ok display button?Please Explain me.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/



Responses

Posted by: Dotnetrajanikanth on: 7/19/2012 [Member] Starter | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/9656/Dissecting-the-MessageBox#DisableClose

You will get a lot of other information from this link.

____________
www.flickr.com/photos/psdesigner/

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 7/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Thanks. I already read this information.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 7/19/2012 [Member] Starter | Points: 25

Up
0
Down
Naraayanan ,

If you have resolved the problem please share the code.

____________
www.flickr.com/photos/psdesigner/

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 7/23/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
No friend,I think, It is not possible.But you are using MessageBoxButtons.YesNo .It is possible.
try this Example
MessageBox.Show("Are you sure, Do you want to Close this Application?","Application Name",MessageBoxButtons.YesNo);


     #region Globals


internal const int SC_CLOSE = 0xF060; //close button's code in windows api
internal const int MF_GRAYED = 0x1; //disabled button status (enabled = false)
internal const int MF_ENABLED = 0x00000000; //enabled button status
internal const int MF_DISABLED = 0x00000002; //disabled button status

[DllImport("user32.dll")] //Importing user32.dll for calling required function
private static extern IntPtr GetSystemMenu(IntPtr HWNDValue, bool Revert);

/// HWND: An IntPtr typed handler of the related form
/// It is used from the Win API "user32.dll"

[DllImport("user32.dll")] //Importing user32.dll for calling required function again
private static extern int EnableMenuItem(IntPtr tMenu, int targetItem, int targetStatus);

#endregion


Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

IS it Possible

R D Patel

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Calvert on: 7/24/2012 [Member] Starter | Points: 25

Up
0
Down
closeable is a config option which will remove that X button. by default its true.How to hide/remove the close [X] button on Ext.Window ?
the config - > closable : false will only disable the close [X] button ,but it is still visible
http://www.dapfor.com/en/net-suite/net-grid/tutorial


Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response