myy
February 14th, 2006, 05:08 PM
Hello,
I have been working on this issue for few days with no luck .
I am sorry for my simple questions as I have never done any work in VC++ before.
I have to modify a VC++ open source software[MyPhone]. What I wanted to do is:
I have a class [CMyPhoneDlg], the structure of this class is:
class CMyPhoneDlg : public CDialog {
public:
CMyPhoneDlg(CWnd* pParent = NULL);
~CMyPhoneDlg();
...
PString m_token;
CMyPhoneEndPoint m_endpoint;
protected:
afx_msg void OnCall();
...
}
In the function [OnCall()], I need to start a thread:
OnCall() {
..
AfxBeginThread(ServerThread,this);
..
}
UINT ServerThread(LPVOID pParam) {
... I need to call, might be
m_endpoint.MakeCall((const char *)curDest, m_token);
.. Or call
CMyPhoneDlg.MyOwnFunction();
}
There might be a few ways to do this such as use of global variable, pass the object instance to the ServerThread, Singleton, etc.
Because I have no experience in VC++, so this work is hard to me. I tried gloabl variable, and got this:
error C2228: left of '.OwnMakeCall2' must have class/struct/union type
I tried to create a static method in CMyPhoneDlg:
void CMyPhoneDlg::OwnMakeCall2()
{
m_endpoint.MakeCall((const char *)"192.168.1.5", m_token);
}
and got errors if i try to call m_endpoint.MakeCall() :
* error C2228: left of '.MakeCall' must have class/struct/union type
* illegal reference to data member 'CMyPhoneDlg::m_token' in a static member function.
This work made me really headache. May anyone help me?
Thanks a lot.
myy
I have been working on this issue for few days with no luck .
I am sorry for my simple questions as I have never done any work in VC++ before.
I have to modify a VC++ open source software[MyPhone]. What I wanted to do is:
I have a class [CMyPhoneDlg], the structure of this class is:
class CMyPhoneDlg : public CDialog {
public:
CMyPhoneDlg(CWnd* pParent = NULL);
~CMyPhoneDlg();
...
PString m_token;
CMyPhoneEndPoint m_endpoint;
protected:
afx_msg void OnCall();
...
}
In the function [OnCall()], I need to start a thread:
OnCall() {
..
AfxBeginThread(ServerThread,this);
..
}
UINT ServerThread(LPVOID pParam) {
... I need to call, might be
m_endpoint.MakeCall((const char *)curDest, m_token);
.. Or call
CMyPhoneDlg.MyOwnFunction();
}
There might be a few ways to do this such as use of global variable, pass the object instance to the ServerThread, Singleton, etc.
Because I have no experience in VC++, so this work is hard to me. I tried gloabl variable, and got this:
error C2228: left of '.OwnMakeCall2' must have class/struct/union type
I tried to create a static method in CMyPhoneDlg:
void CMyPhoneDlg::OwnMakeCall2()
{
m_endpoint.MakeCall((const char *)"192.168.1.5", m_token);
}
and got errors if i try to call m_endpoint.MakeCall() :
* error C2228: left of '.MakeCall' must have class/struct/union type
* illegal reference to data member 'CMyPhoneDlg::m_token' in a static member function.
This work made me really headache. May anyone help me?
Thanks a lot.
myy