How can I show only Cancel button on Messagebox
-
Hi All, I am trying to show a message box with only one button"Cancel".
int MessageBox( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);in uType we can give MB_OK or MB_OKCANCEL. But I want to have only one button on messagebox ie "Cancel". how can I get this. Thanks .. Sheshidar
-
Hi All, I am trying to show a message box with only one button"Cancel".
int MessageBox( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);in uType we can give MB_OK or MB_OKCANCEL. But I want to have only one button on messagebox ie "Cancel". how can I get this. Thanks .. Sheshidar
You can use of MB_OK.
-
Hi All, I am trying to show a message box with only one button"Cancel".
int MessageBox( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);in uType we can give MB_OK or MB_OKCANCEL. But I want to have only one button on messagebox ie "Cancel". how can I get this. Thanks .. Sheshidar
I don't think it is possible with MessabeBox. You can simple create your own dialog and add a single cancel button. -Saurabh
-
You can use of MB_OK.
Yes but MB_OK is not going to give him Cancel button. -Saurabh
-
I don't think it is possible with MessabeBox. You can simple create your own dialog and add a single cancel button. -Saurabh
-
Thanks Guys, I created a new dialog to work with cancel button. I wanted to try with messagebox only. Any way thanks for ur replies.
You are welcome. Btw you may want to check out XMessageBox - A reverse-engineered MessageBox() [^]. It has more functionality then standard MessageBox and also allows custom buttons. -Saurabh
-
Yes but MB_OK is not going to give him Cancel button. -Saurabh
I dont think we have MB_CANCEL but I think he can changes title of button.
-
I dont think we have MB_CANCEL but I think he can changes title of button.
After reading MSDN documentation I couldn't find anything. Do you know how to do that? -Saurabh
-
After reading MSDN documentation I couldn't find anything. Do you know how to do that? -Saurabh
You can get a handle to a messagebox window and then you can change text of it.
-
You can get a handle to a messagebox window and then you can change text of it.
MessageBox is a modal window so it blocks the calling thread. So once you call MessageBox then unless you dismiss it nothing else can be done. -Saurabh
-
MessageBox is a modal window so it blocks the calling thread. So once you call MessageBox then unless you dismiss it nothing else can be done. -Saurabh
I saw my files it was on the C#.
-
I saw my files it was on the C#.
I hate to do this but it is not going to work in C# as well. System.Windows.Forms.MessageBox mimics MessageBox in windows. So there is no option to use just the Cancel button. -Saurabh
-
I hate to do this but it is not going to work in C# as well. System.Windows.Forms.MessageBox mimics MessageBox in windows. So there is no option to use just the Cancel button. -Saurabh
Saurabh.Garg wrote:
I hate to do this but it is not going to work in C#
Why c# is good I think its easy to learn anyway maybe you like to see Dissecting the MessageBox[^].
-
Saurabh.Garg wrote:
I hate to do this but it is not going to work in C#
Why c# is good I think its easy to learn anyway maybe you like to see Dissecting the MessageBox[^].
I never asked why C# is good!!! We were talking about MessageBox. I have seen that article and it create a new class for doing custom stuff. It has got nothing to do with MessageBox WinAPI provides. -Saurabh