您的位置:首页 > 其它

no instance of overloaded function "AfxMessageBox" matches the argument list

2013-03-25 23:09 1046 查看
问题描述

AfxMessageBox("Failed to connect to server\nTry again?",MB_YESNO)
出现问题:no instance of overloaded function "AfxMessageBox" matches the argument list

 

解决方案

添加 L  如下

AfxMessageBox( L"Failed to connect to server\nTry again?",MB_YESNO)

 

究其原因是“字符集”的问题,改“使用 Unicode 字符集”为 “使用多字节字符集”  AfxMessageBox("Failed to connect to server\nTry again?",MB_YESNO)   不添加 L 也 可以。

 

int AfxMessageBox(

LPCTSTR lpszText,

UINT nType = MB_OK,

UINT nIDHelp = 0

);

Parameters

lpszText Points to a CString object or null-terminated string containing the message to be displayed in the message box.
nType The style of the message box. Apply any of the
message-box styles to the box. nIDHelp The Help context ID for the message; 0 indicates the application's default Help context will be used.

Remarks

The first form of this overloaded function displays a text string pointed to by
lpszText in the message box and uses nIDHelp to describe a Help context. The Help context is used to jump to an associated Help topic when the user presses the Help key (typically F1).

Example

// A simple message box, with only the OK button.

AfxMessageBox("Simple message box.");

// A message box that uses a string from a string table

// with yes and no buttons and the stop icon.

// NOTE: nStringID is an integer that contains a valid id of

// a string in the current resource.

AfxMessageBox(nStringID, MB_YESNO|MB_ICONSTOP);


 


 


 


参考:AfxMessageBox 在vs2008中的问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  AfxMessageBox
相关文章推荐