SetTimer
-
Hi: As you know "SetTimer" has the following syntax: UINT_PTR SetTimer( HWND hWnd, // handle to window UINT_PTR nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc); // timer procedure I have problem with first parameter.i used m_hWnd (public member),but it doesn't work!!!.now in my MFC application,what should i choose for first parameter ? in the other hand how can i get a handle to the form or dialog's window ? please help me. Best Regards.
-
Hi: As you know "SetTimer" has the following syntax: UINT_PTR SetTimer( HWND hWnd, // handle to window UINT_PTR nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc); // timer procedure I have problem with first parameter.i used m_hWnd (public member),but it doesn't work!!!.now in my MFC application,what should i choose for first parameter ? in the other hand how can i get a handle to the form or dialog's window ? please help me. Best Regards.
In MFC,
SetTimer()
is aCWnd
method. Just call it in your dialog'sOnInitDialog()
or in your CFormView'sOnInitialUpdate()
. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com -
Hi: As you know "SetTimer" has the following syntax: UINT_PTR SetTimer( HWND hWnd, // handle to window UINT_PTR nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc); // timer procedure I have problem with first parameter.i used m_hWnd (public member),but it doesn't work!!!.now in my MFC application,what should i choose for first parameter ? in the other hand how can i get a handle to the form or dialog's window ? please help me. Best Regards.
HWND GetDlgItem( int nID ) will give you the window handle. You could actually use CWnd::SetTimer which doesn't require a handle as a parameter. UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) ); For your Callback function you can have a NULL parameter and you can handle WM_TIMER instead or CWnd::OnTimer(UINT nIDEvent ); // Afterall I realized that even my comment lines have bugs
-
Hi: As you know "SetTimer" has the following syntax: UINT_PTR SetTimer( HWND hWnd, // handle to window UINT_PTR nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc); // timer procedure I have problem with first parameter.i used m_hWnd (public member),but it doesn't work!!!.now in my MFC application,what should i choose for first parameter ? in the other hand how can i get a handle to the form or dialog's window ? please help me. Best Regards.
What do you mean "it doesn't work"? It won't compile? It formats your drive? When you call
SetTimer
in a window class, you useCWnd::SetTimer
, which doesn't take anHWND
parameter. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me -
What do you mean "it doesn't work"? It won't compile? It formats your drive? When you call
SetTimer
in a window class, you useCWnd::SetTimer
, which doesn't take anHWND
parameter. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to meMichael Dunn wrote: It formats your drive? Bad day @ work, Mike? :) /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com
-
Hi: As you know "SetTimer" has the following syntax: UINT_PTR SetTimer( HWND hWnd, // handle to window UINT_PTR nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc); // timer procedure I have problem with first parameter.i used m_hWnd (public member),but it doesn't work!!!.now in my MFC application,what should i choose for first parameter ? in the other hand how can i get a handle to the form or dialog's window ? please help me. Best Regards.
MR ZarrinPour wrote: now in my MFC application,what should i choose for first parameter ? Have a look at GetSafeHwnd(), although CWnd::SetTimer() is probably what you should be using.