Sample - Use of Pseudo-this Pointer in C++: Notes Code
class A
{
public:
A();
public:
static A* g_pPseudoThis;
static UINT CALLBACK UpdateData( HWND hWnd,
UINT uMsg,
UINT idEvent,
DWORD dwTime );
UINT m_nTimerID;
int m_nUpdateInterval;
void Print();
};
A* A::g_pPseudoThis = NULL;
A::A()
{
g_pPseudoThis = this;
m_nUpdateInterval = 2000;
m_nTimerID = SetTimer( NULL,
NULL,
m_nUpdateInterval,
(TIMERPROC)UpdateData ); //TimerProc
}
UINT CALLBACK A::UpdateData( HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime )
{
g_pPseudoThis->Print();
return S_OK;
}
void A::Print()
{
MessageBox(NULL, "Call form callback ...", "Print()", MB_OK);
}
(c) 2002, Stan Malevanny