AfxMessageBox() MFC 函数存在一些问题
我正在制作一个使用 Open.Cv 从相机加载图片的程序..
并且我在 AfxMessageBox() 语句中遇到错误..
program:
BOOL CObjectBoundDetectDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
int nSelected = cvcamGetCamerasCount();
if(nSelected == 0)
{
AfxMessageBox("Camera have no connection",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
error:
Error 2错误 C2665: 'AfxMessageBox' : 2 个重载中没有一个可以转换所有参数类型 c:\program files\microsoft Visual Studio 10.0\my project\objectbounddetect\objectbounddetect\objectbounddetectdlg.cpp 126 1 ObjectBoundDetect
如果我查看 AfxMessageBox() 的定义 ... 在此提供 [链接]](http://msdn.microsoft.com/en-us/library/as6se7cb(v=vs.80).aspx) ...它应该可以工作..但我认为参数列表中存在一些问题..我不明白...
根据定义.. AfxMessageBox() 语句不应让我出错...
任何人都可以帮助我解决这个问题..期待一个好的答复,谢谢..
注意: 相机已经附上,..相机没问题..
I am making a program for loading a picture from camera using Open.Cv ..
And i am getting error in AfxMessageBox() statement..
program:
BOOL CObjectBoundDetectDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
int nSelected = cvcamGetCamerasCount();
if(nSelected == 0)
{
AfxMessageBox("Camera have no connection",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
error:
Error 2 error C2665: 'AfxMessageBox' : none of the 2 overloads could convert all the argument types c:\program files\microsoft visual studio 10.0\my project\objectbounddetect\objectbounddetect\objectbounddetectdlg.cpp 126 1 ObjectBoundDetect
if i look on the defination of AfxMessageBox() ... provided in this
[link]](http://msdn.microsoft.com/en-us/library/as6se7cb(v=vs.80).aspx) ... it should work.. but i think some problem in parameter list .. that i am not understanding...
According to the defination.. AfxMessageBox() statement should not make me error ...
Any one can help me with this problem .. Expoecting a good response thanks ..
Note: Camera is already Attached,.. no problem with camera ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
两种可能性:
尽管我对此表示怀疑,但您可能必须将其范围扩展到全球范围。要做到这一点,请尝试
另一个是 use arebuilding for unicode 并且它认为该字符串是多字节的。要做到这一点,请尝试
我不在城里,在我的 Mac 上,所以我无法对此进行测试。但周末我一直被困在办公室,所以我想我可以尝试两件事。
Two possibilities:
You may, although I doubt this, have to scope it globally. To do that, try
The other is that use are building for unicode and it thinks the string is multi-byte. To do that, try
I'm out of town, on my Mac, so I can't test this. But I have been stuck in the office on weekends so I figured I'd offer up two things to try.
上面的代码运行没有任何问题。如果您仍然想使用:
您可以转到项目属性,在常规选项卡中,您可以将字符集从“使用 Unicode 字符集”更改为“使用多字节字符集”
The above code worked without any issue. If you still want to go with:
You can go to Project properties, in general tab you can change Character set from "Use Unicode Character Set" to "Use Multi-Byte Character Set"
使用如下:
Use as below: