I have a class that derives from CListCtrl called MyListCtrl, and another class that derives from CWnd called Utilities; they're in separate projects within the same workspace:


// Utilities.h: interface for the Utilities class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UTILITIES_H__D7DDA98F_2D94_11D4_B891_00508B35B83F__INCLUDED_)
#define AFX_UTILITIES_H__D7DDA98F_2D94_11D4_B891_00508B35B83F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class Utilities : public CWnd
{
public:
Utilities();
virtual ~Utilities();
int MessageBox(LPCTSTR pMessage, UINT pBoxStyle);
};

#endif // !defined(AFX_USERMSGBOX_H__D7DDA98F_2D94_11D4_B891_00508B35B83F__INCLUDED_)






// Utilities.cpp: implementation of the Utilities class.
//
//////////////////////////////////////////////////////////////////////

#include "Utilities.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Utilities::Utilities()
{
}

Utilities::~Utilities()
{
}
int Utilities::MessageBox(LPCTSTR pMessage, UINT pBoxStyle)
{
return ::MessageBox(NULL, pMessage, "Utilities", pBoxStyle);
}




In one of the functions of MyListCtrl I called Utilities::MessageBox:


#include "..\Utilities\Utilities.h"
.
.
void MyListCtrl::OnOpsAdd()
{
Utilities::MessageBox("OnOpsAdd", MB_OK);
return;
}




I'm getting this compilation error that doesn't make alot of sense to me (but then I'm not that experienced of a VC++ programmer...)

"error C2352: 'Utilities::MessageBoxA' : illegal call of non-static member function"

Any idea?

Thanks for any input.