Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wrote:

int DisplayResourceNAMessageBox()
{
	int msgboxID = MessageBox(
		NULL,
		(LPCWSTR)L"Resource not available\nDo you want to try again?",
		(LPCWSTR)L"Account Details",
		MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
	);

	switch (msgboxID)
	{
	case IDCANCEL:
		// TODO: add code
		break;
	case IDTRYAGAIN:
		// TODO: add code
		break;
	case IDCONTINUE:
		// TODO: add code
		break;
	}

	return msgboxID;
}

void CMFCApplication7Dlg::OnBnClickedMessage()
{
	//TCHAR e[1000] = _T("HELLO");
	//MessageBox(NULL, e);
	DisplayResourceNAMessageBox;


	
	// TODO: Add your control notification handler code here
}


What I have tried:

message box doen't show when I click button, but I don't know why, I work with mfc c++
Posted
Updated 20-Sep-19 3:29am
v2

You don't call the containing method:
C++
void CMFCApplication7Dlg::OnBnClickedMessage()
{
	DisplayResourceNAMessageBox;
}
Add "()" to the line:
C++
void CMFCApplication7Dlg::OnBnClickedMessage()
{
	DisplayResourceNAMessageBox();
 
Share this answer
 
Quote:
void CMFCApplication7Dlg::OnBnClickedMessage()
{
//TCHAR e[1000] = _T("HELLO");
//MessageBox(NULL, e);
DisplayResourceNAMessageBox;

Since you missed the round brackets, the statement has NO effect. Replace it with
C++
DisplayResourceNAMessageBox();


Remember to enable all the warnings of your compiler.
 
Share this answer
 
Comments
Member 14594285 20-Sep-19 9:39am    
I solved, I didn't write cmfApplication::Display..
if I wrote in .h

int DysplayResourcedNAMessageBox()

and in .cpp

DisplayResourceNAMessageBox();


I have this error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	LNK2019	unresolved external symbol "public: int __thiscall CMFCApplication7Dlg::DisplayResourceNAMessageBox(void)" (?DisplayResourceNAMessageBox@CMFCApplication7Dlg@@QAEHXZ) referenced in function "public: void __thiscall CMFCApplication7Dlg::OnBnClickedButton6(void)" (?OnBnClickedButton6@CMFCApplication7Dlg@@QAEXXZ)	MFCApplication7	C:\Dev2015\Prg\MFCApplication7\MFCApplication7Dlg.obj	1	
 
Share this answer
 
Comments
Richard Deeming 20-Sep-19 9:39am    
Yet another comment posted as a "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900