问题描述
大家好,
我看过VC ++代码.
:: FindNextFile().这是MFC函数.我们可以不使用"::"来调用此函数吗?
运算符.如果那为什么我们使用::运算符.我也看到了相同的调用
用户定义函数中的过程.它是
Hi all,
I have seen a VC++ code.
::FindNextFile().It is an MFC function.Can we call this function without using "::"
operator.If then why we are using :: operator.Also i have seen same calling
procedure in an user defined function.And it is
::DisplayMessage(&m_RichEditLog,csMessage,1);
相应的.CPP文件是
And the corresponding .CPP file is
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
DWORD CALLBACK RichEditStreamInCallBack(DWORD dwCookie,LPBYTE pbBuff,LONG cb, LONG *pcb)
{
return 0;
}
void DisplayMessage(CRichEditCtrl * pRichEdit,const CString &cstrMessage,int nFlags/*=FALSE*/)
{
}
void SaveText(CRichEditCtrl * pRichEdit,const CString & strFile)
{
}
DWORD CALLBACK RichEditStreamOutCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
return 0;
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.h文件是
.h file is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DWORD CALLBACK RichEditStreamInCallBack(DWORD dwCookie,LPBYTE pbBuff,LONG cb, LONG *pcb);
void DisplayMessage(CRichEditCtrl * pRichEdit,const CString & cstrMessage,int nFlags/*=FALSE*/);
void SaveText(CRichEditCtrl * pRichEdit,const CString & strFile);
static DWORD CALLBACK RichEditStreamOutCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
请帮帮我.
在此先感谢
Please help me.
Thanks in advance
推荐答案
#include <afxwin.h>
....
....
class MyClass
{
....
int AfxMessageBox(...)
{
//DO SOMETHING
}
....
}
.........</afxwin.h>
当您从类中调用函数AfxMessageBox()时,它将指向您类中的成员函数AfxMessageBox().但是,如果要调用MFC函数AfxMessageBox()怎么办?
那个时候你叫它
When you call the function AfxMessageBox() from your class, it will point to the member function AfxMessageBox() in your class. But what if you want to call the MFC function AfxMessageBox()??.
That time you call it like
::AfxMessageBox()
这篇关于为什么在函数前使用::的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!