Setting Callback function inside a class

Apart from setting a callback function as Static inside a class, is there any way to set it inside a class coz I have to access a class function inside the callback function of SetTimer(HWND hWnd, UINT nMsg , UINT nIDEvent, DWORD dwTime);??
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Unfortunately there is no other way.
But you still can use
CWnd* CWnd::FromHandle( WHND hWnd )
wich is static and thus preventing you from useing it with a certain instance of any CWnd object.
So the decision is:
void CALLBACK CYourWndClass::TimerProc ( HWND hWnd, UING nMsg, UINT idEvent, DWORD dwTime )
  CYourWndClass* pWnd = (CYourWndClass*)CWnd::FromHandle ( hWnd );

  //do whatever you want to do :)

TimerProc is still static method of CYourWndClass and you can do exactly what you whant.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vinayak KumbarSr Program ManagerCommented:

U can call the class's member function from the call back function. As I have suggested U, say u have callback function MyTimerProc for App class CCallbackApp. Now in the callback function u can call the app class member as

CCallbackApp *pApp = (CCallbackApp *)AfxGetApp();

Where OnEditCut() is the member function for CCallbackApp class.

Try it out.
Vinayak KumbarSr Program ManagerCommented:

Similarly U can access the mainframe's functions also. And to access the members of the different class, I have suggested the method in Ur's different question. Check it out.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.