i am trying to create a simple class to simply create an imagelist which i will later on use in a toolbar class. The problem is that the empty Add() member function has an error
error: request for member `Add' in `myImageList', which is of non-class type `CImageList ()()'
i have searched around the forum and i got similar errors but i believe that their problems were different.
this is the class declaration in file CImageList.h
#include<commctrl.h>
class CImageList
{
public:
CImageList();
~CImageList();
void Add();
private:
HIMAGELIST m_hImageList;
};
and this is the definition
#include<windows.h>
#include<commctrl.h>
#include "CImageList.h"
CImageList::CImageList()
{
m_hImageList=ImageList_Create(32, 32, ILC_COLOR32, 0, 15);//returns NULL if the fuction fails
if(!m_hImageList) MessageBox(NULL,"failed to create m_hImageList","CImageList constructor error",MB_ICONERROR);
else MessageBox(NULL,"m_hImageList created sucessfully :)","CImageList constructor ",MB_OK);
}
CImageList::~CImageList()
{
}
void CImageList::Add()
{
//currently empty but for adding icons to imagelist
}
then in main.cpp I added these
#include "CImageList.h"
CImageList myImageList;
...
...
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_CREATE:
myImageList.Add();//HERE IS THE ERROR
break;
....
....
}
}
Here is part of the compile log... iam using devcpp version 4.9.9.2
main.cpp: In function `LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)':
main.cpp:80: error: request for member `Add' in `myImageList', which is of non-class type `CImageList ()()'
make.exe: *** [main.o] Error 1
Execution terminated
ps: sorry for the long code but i have no clue what this error means.
Thanks in advance
from Dr deo