Click here to Skip to main content
15,915,091 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General(ADSI) Active Directory... Pin
Braulio Dez28-May-03 2:59
Braulio Dez28-May-03 2:59 
Questionhow to connect mysql server Pin
siong28-May-03 2:10
siong28-May-03 2:10 
Generalan error respawns.. Pin
safee ullah28-May-03 0:48
safee ullah28-May-03 0:48 
GeneralRe: an error respawns.. Pin
Rage28-May-03 1:23
professionalRage28-May-03 1:23 
GeneralRe: an error respawns.. Pin
safee ullah28-May-03 20:06
safee ullah28-May-03 20:06 
GeneralDialog box question Pin
Jump_Around28-May-03 0:12
Jump_Around28-May-03 0:12 
GeneralRe: Dialog box question Pin
Rage28-May-03 1:14
professionalRage28-May-03 1:14 
GeneralRe: Dialog box question Pin
Jump_Around29-May-03 1:40
Jump_Around29-May-03 1:40 
Generalnamespaces problem ... Pin
flybird27-May-03 21:48
flybird27-May-03 21:48 
GeneralRe: namespaces problem ... Pin
Rage28-May-03 1:16
professionalRage28-May-03 1:16 
GeneralFile searching Pin
Shah Shehpori27-May-03 21:21
sussShah Shehpori27-May-03 21:21 
GeneralRe: File searching Pin
David Crow28-May-03 3:11
David Crow28-May-03 3:11 
GeneralRe: File searching Pin
Dudi Avramov28-May-03 3:13
Dudi Avramov28-May-03 3:13 
QuestionHow to 'talk' to an OPC server Pin
Vassili27-May-03 21:03
Vassili27-May-03 21:03 
Generaldisable/enable network adapter card on NT4 Pin
Member 36342727-May-03 20:34
Member 36342727-May-03 20:34 
GeneralRe: disable/enable network adapter card on NT4 Pin
David Crow28-May-03 4:30
David Crow28-May-03 4:30 
Generalstatic function access member variable and member function Pin
yccheok27-May-03 20:09
yccheok27-May-03 20:09 
GeneralRe: static function access member variable and member function Pin
Daniel Strigl27-May-03 20:25
Daniel Strigl27-May-03 20:25 
You need the this pointer in your static callback function!

Just take a look at Why can't I use a member function as a callback? at The Code Project Visual C++ Forum FAQ.

One way is to save the this pointer in a static member variable, like this:
class CXFaceRecognitionDlg : public CDialog
{
// Construction
public:
CXFaceRecognitionDlg(CWnd* pParent = NULL); // standard constructor
static void callback(IplImage* image);
static CXFaceRecognitionDlg* m_pThis; 
};

static CXFaceRecognitionDlg::m_pThis = NULL;

// Somewhere in one of your member function
{
    ...
    m_pThis = this;
    ...
    // call the function that need the callback function
    FunctionThatNeedCallback(callback);
    ...
}

void CXFaceRecognitionDlg::callback(IplImage* image)
{
DetectAndDrawFaces( image ); // c function lib

// Here you can use the static pointer to this

this->DoSomeMemberFunction(...); // must be public

}

Daniel Wink | ;)
---------------------------
Never change a running system!
GeneralRe: static function access member variable and member function Pin
John R. Shaw27-May-03 20:59
John R. Shaw27-May-03 20:59 
GeneralRe: static function access member variable and member function Pin
John R. Shaw27-May-03 20:47
John R. Shaw27-May-03 20:47 
GeneralQuestion for the strong Pin
aguest27-May-03 19:17
aguest27-May-03 19:17 
GeneralRe: Question for the strong Pin
John R. Shaw27-May-03 19:53
John R. Shaw27-May-03 19:53 
GeneralRe: Question for the strong Pin
qweas27-May-03 19:56
qweas27-May-03 19:56 
GeneralRe: Question for the strong Pin
aguest27-May-03 22:30
aguest27-May-03 22:30 
GeneralRe: Question for the strong Pin
Rage28-May-03 1:21
professionalRage28-May-03 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.