convert from void (__thiscall Phone::* )(pjsua_acc_id) to void (__cdecl *)(pjsua_acc)

Joined
Apr 2, 2009
Messages
2
Reaction score
0
I am pointing the member function of a class to the callbacks of a library function . It gives the following error
“cannot convert from 'void (__thiscall Phone::* )(pjsua_acc_id)' to 'void (__cdecl *)(pjsua_acc_id)' There is no context in which this conversion is possible”

Following is the coding in my program

/*********** Phone.h************/
#include <pjsua-lib/pjsua.h>
Phone:: public CDialog
{

void on_reg_state(pjsua_acc_id acc_id);
….
}

/************ Phone.cpp ***********/
#include "Phone.h"
void Phone:: on_reg_state(pjsua_acc_id acc_id)
{
pjsua_acc_info info;
CString reg_status;

pjsua_acc_get_info(acc_id,&info);
reg_status=info.status_text.ptr;

/** Now update the registration status on Phone’s main dialog, m_userinfo is the edit control value variable on Phone’s main dialog ******/
m_userinfo=reg_status;
UpdateData(false);
}

BOOL Phone:: OnInitDialog()
{
…………………………………………
pjsua_config cfg; //pjsua_config is a struct
……………………………………
cfg.cb.on_reg_state = &Phone:: on_reg_state;
---------------------------
…………………………………………….
}

/*********** pjsua.h**********/

typedef struct pjsua_config
{
…………..
pjsua_callback cb;
…………….
}

typedef struct pjsua_callback
{
……………………………………………….
void (*on_reg_state)(pjsua_acc_id acc_id);
……………………………………………………

}


if I declare the on_reg_state as a static function, the UpdateData(false) gives error as it cannot access the members of the class Phone. And if I dont call the "UpdateData(false)", the message is not updated.

I am badly stuck in this, please help :hmm2:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top