VC++ 2005 Question
Hi,
I am trying to use the code like the one described below......
namespace MyPhone
{
public class ref phone
{
.......
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
callFunc();
}
public: void callFunc()
{
tryThis(NULL, proc, NULL); //proc is another function it has to call - Error
}
public: proc(void* p1, void* p2, void* p3)
{
....
}
....
};
}
The above code gives me this error:
error C3867: 'MyPhone:hone:roc': function call missing argument list; use '&MyPhone:hone::EventProc' to create a pointer to member
can anyone please help me resolve this error. I tried creating delegates as per msdn, but I guess, I am losing some syntax.
Thank You for your reply,
However, I am sorry, the code snippet I posted had some mistakes....the real code snippet is as follows....
namespace MyPhone
{
public class ref phone
{
.......private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
callFunc();
}
public: void callFunc()
{
tryThis(NULL, proc, NULL); //proc is another function it has to call - Error
}
public: proc(void* p1, void* p2, void* p3)
{
....
}
....
};
}
The above code gives me this error:
error C3867: 'MyPhone:phone:proc': function call missing argument list; use '&MyPhone:phone::proc' to create a pointer to member
and when I use &MyPhone:phone:proc, it gives me this error :
error C3374: can't take address of 'MyPhone::phone:proc' unless creating delegate instance
Do what the error suggests, and create a delegate. Since you are working with C++/CLI here, managed clases can't take function pointers, you need to use delegates instead.
I am not that great with VC++ .Net, can you please tell me how to create a delegate in VC++ .Net.
It will be of great help.
Thank You in advance for your time and effort.