Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MessageBox buttons: How to customize names

Status
Not open for further replies.

Weber1

Programmer
Sep 9, 2000
20
US
Hello, I am trying to implement a two-button message box (for errors and warnings) and I'd like one of the buttons to be something like "Log to File" and the other to be something like "Close". I haven't been able to find any way to rename the buttons, however.

This is what I have so far (code that implements and "OK/Cancel" type messagebox):

// This section just fills in the data for MessageBox call
//----------------------------------------------------
LPCTSTR lpszText = ErrorText.Getstring();
LPCTSTR lpszCaption;

switch(Error_or_Warning)
{
case FATAL_ERROR: lpszCaption = "ERROR"; break;
case WARNING: lpszCaption = "WARNING"; break;
default: lpszCaption = "ERROR"; break;
}

UINT nType = MB_ICONERROR | MB_OKCANCEL | MB_APPLMODAL;

//--------------------------------------------------------
// This section calls MessageBox and handles its callback

switch(MessageBox(hwnd, lpszText, lpszCaption, nType))
{
case IDOK: Log_Error_to_File(ERRORFILEPATHANDFILENAME, Error_ID_Found, Error_Label);
break;
case IDCANCEL : break;
default: break;
}

 
The MessageBox has only a limited set of buttons, the standard Yes/No/Ok/Cancel etc.

You have to make a complete dialog yourself with whatever buttons.



/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top