Original Post
hi,
i am implementing a TaskManager, what i want is that any class that want to define a task will simply send a structure to the TaskManager. this structure will hold information about the task (name, expiration time etc) plus a pointer to the method of the class in question. I know that i can''t have a general method pointer to any method of any class, i have to specify the class, so i was thinking about using a void* pointer. But it did''n work,
Is it possible to do such manipulation? or i have to absolutely cast the pointer before calling the method?
here''s what my code look like:
the structure:
struct sTask
{
int nID;
int nType;
bstring szName;
bstring szOwner;
void* pMth;
};
the setting of the task informations:
// i must do that so it can compile
void (CStarGate::*pmth)(void);
pmth =&CStarGate::taskBlink;
sTask task;
task.nID = CGlobalInfo::Instance()->getUniqueID();
task.nType= TASK_MONO_CYCLE;
task.pMth = &pmth
task.szName="taskBlink";
task.szOwner="CStarGate";
this->vTask.push_back(task); //this vector is later read by the task manager
then in my TaskManager i try to call the method, i try many way but none work. It''s the first time I am dealing with void* pointer and i can''t find descent documentation, do you have any link or idea about this problem?
thanks