Timer Problem
-
Hi All I am useing timer in main dialog class.Calling Timer on On OnInitDialog function.But my dilaog become not responding.Plz help me.
It is most likely because you did something wrong. ... but seriously, give some code, more details, otherwise noone will be able to help you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Hi All I am useing timer in main dialog class.Calling Timer on On OnInitDialog function.But my dilaog become not responding.Plz help me.
How are you 'Calling Timer' (you know, no code => no help... :rolleyes: )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
How are you 'Calling Timer' (you know, no code => no help... :rolleyes: )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]void CTimer::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
OnBnClickeTimer();
CDialog::OnTimer(nIDEvent);
}void CTimer::OnStartTimer()
{
SetTimer(2,10000, 0);
}void CTimer::OnStopTimer()
{
KillTimer (0);
}BOOL CTimer::OnInitDialog()
{
OnBnClickeTimer();}
void CTimer::OnBnClickedTimer()
{check: for(;aq<10) { finalString=a1\[aq\]; char \* szMyString = (char \*)(LPCTSTR)finalString; CString string = \_T(szMyString); CString DirPath; CString string1=string; string1 +='\\0'; int nLen = string1.GetLength(); LPCSTR lpszBuf = string1.GetBuffer(nLen); string1.ReleaseBuffer(); LPCSTR pF=lpszBuf; LPCSTR pT="c:\\\\Backup"; if (!fo.Copy(pF,pT)); aq++; } OnStopTimer();
}
CString a1[aq] is external vaiable. Plz help me
modified on Tuesday, February 24, 2009 6:43 AM
-
Hi All I am useing timer in main dialog class.Calling Timer on On OnInitDialog function.But my dilaog become not responding.Plz help me.
Timers tutorial[^] is for you.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
void CTimer::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
OnBnClickeTimer();
CDialog::OnTimer(nIDEvent);
}void CTimer::OnStartTimer()
{
SetTimer(2,10000, 0);
}void CTimer::OnStopTimer()
{
KillTimer (0);
}BOOL CTimer::OnInitDialog()
{
OnBnClickeTimer();}
void CTimer::OnBnClickedTimer()
{check: for(;aq<10) { finalString=a1\[aq\]; char \* szMyString = (char \*)(LPCTSTR)finalString; CString string = \_T(szMyString); CString DirPath; CString string1=string; string1 +='\\0'; int nLen = string1.GetLength(); LPCSTR lpszBuf = string1.GetBuffer(nLen); string1.ReleaseBuffer(); LPCSTR pF=lpszBuf; LPCSTR pT="c:\\\\Backup"; if (!fo.Copy(pF,pT)); aq++; } OnStopTimer();
}
CString a1[aq] is external vaiable. Plz help me
modified on Tuesday, February 24, 2009 6:43 AM
- Please check the posted code (for instance use
<
to escape the symbol<
when required). - Why are you calling directly the timer function inside
OnInitDialog
(instead of starting the timer? You may actually do it, but usually you haven't...)? - Since you're calling directly (form
OnInitDialog
) your timer function (OnBnClickedTimer
) it doesn't make sense theOnStopTimer
call in the latter.
Anyway your application 'freezes' possibly because of a bug in your loop. You should debug it in order to have a clue about (ispecting your code is also difficult because of the, already mentioned, bad formatting). :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] - Please check the posted code (for instance use
-
- Please check the posted code (for instance use
<
to escape the symbol<
when required). - Why are you calling directly the timer function inside
OnInitDialog
(instead of starting the timer? You may actually do it, but usually you haven't...)? - Since you're calling directly (form
OnInitDialog
) your timer function (OnBnClickedTimer
) it doesn't make sense theOnStopTimer
call in the latter.
Anyway your application 'freezes' possibly because of a bug in your loop. You should debug it in order to have a clue about (ispecting your code is also difficult because of the, already mentioned, bad formatting). :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] - Please check the posted code (for instance use
-
Yes, you are right, of course. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]