MFC自定义函数怎么调用啊。。。其他语言转过来的
我用MFC做了一个小小的demo,点鼠标左键弹出对话框。
我在CHttptest11View自定义了一个函数
在CHttptest11View.h里写了声明
int getMo();
然后在CHttptest11View.cpp里写了实现
int CHttptest11View::getMo()
{
int i = 2;
return i;
}
我在OnLButtonDown里这样调用的
void CHttptest11View::OnLButtonDown(UINT nFlags, CPoint point)
{
int j = ::getMo();
CString s;
s.Format("%d", j);
MessageBox(s);
CView::OnLButtonDown(nFlags, point);
}
却一直报错
Compiling...
Httptest11View.cpp
F:\C++\Httptest11\Httptest11View.cpp(113) : error C2039: 'getMo' : is not a member of '`global namespace''
执行 cl.exe 时出错.
网上找了一下,说头文件有错
头文件如下:
#include "stdafx.h"
#include "Httptest11.h"
#include <string>
#include "Sms.h"
#include "Httptest11Doc.h"
#include "Httptest11View.h"
实在不知道哪里有错了
我在CHttptest11View自定义了一个函数
在CHttptest11View.h里写了声明
int getMo();
然后在CHttptest11View.cpp里写了实现
int CHttptest11View::getMo()
{
int i = 2;
return i;
}
我在OnLButtonDown里这样调用的
void CHttptest11View::OnLButtonDown(UINT nFlags, CPoint point)
{
int j = ::getMo();
CString s;
s.Format("%d", j);
MessageBox(s);
CView::OnLButtonDown(nFlags, point);
}
却一直报错
Compiling...
Httptest11View.cpp
F:\C++\Httptest11\Httptest11View.cpp(113) : error C2039: 'getMo' : is not a member of '`global namespace''
执行 cl.exe 时出错.
网上找了一下,说头文件有错
头文件如下:
#include "stdafx.h"
#include "Httptest11.h"
#include <string>
#include "Sms.h"
#include "Httptest11Doc.h"
#include "Httptest11View.h"
实在不知道哪里有错了
...全文
相关推荐
在MFC下调用C#DLL库函数实例
**调用C# DLL函数**: - 在MFC应用程序的适当位置,如按钮点击事件处理程序,调用定义的C++函数。
MFC中自定义消息
【转】MFC中用户自定义类响应自定义消息 2009-08-13 17:15:11| 分类: MFC学习 | 标签: |字号大中小 订阅 这篇技术文章不是讨论经典的MFC中的消息工作机理的,讨论消息工作原理、方式和路径的文章在网上和书本中 随处可见。网上众多
MFC调用WPF函数
很多情况下WPF调用MFC中的函数,但是也许会有特俗的情况,即MFC调用WPF中的函数。
mfc中一个函数是如何调用的?
**C++语法** MFC函数调用遵循C++的常规语法,包括对象实例化、成员访问、虚函数调用等。例如,通过`.
MFC程序调用Qt界面
**调用自定义的Qt界面** - 在MFC程序中,通过加载Qt DLL并调用其中的`main`函数来显示自定义的Qt界面。


