Click here to Skip to main content
15,886,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: PreTranslateMessage problem? :( Pin
Randor 24-Feb-12 10:12
professional Randor 24-Feb-12 10:12 
AnswerRe: PreTranslateMessage problem? :( Pin
JackDingler24-Feb-12 10:56
JackDingler24-Feb-12 10:56 
QuestionHow to fix compile error error C2535 Pin
KASR124-Feb-12 0:06
KASR124-Feb-12 0:06 
AnswerRe: How to fix compile error error C2535 Pin
Code-o-mat24-Feb-12 22:50
Code-o-mat24-Feb-12 22:50 
QuestionHow to create toolbar on the dialog. Pin
appollosputnik23-Feb-12 23:11
appollosputnik23-Feb-12 23:11 
AnswerRe: How to create toolbar on the dialog. Pin
_AnsHUMAN_ 24-Feb-12 1:24
_AnsHUMAN_ 24-Feb-12 1:24 
QuestionRe: How to create toolbar on the dialog. Pin
David Crow24-Feb-12 3:15
David Crow24-Feb-12 3:15 
QuestionOnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 21:50
shanmugarajaa23-Feb-12 21:50 
Hi friends,
When i close the dialog that time OnTimer function is automaticaly killed. I dont know what is the reason behind this. For your information this dialog is added in the PropertySheet. Normally, if dialog is closed also the onTimer function keep run.. But i my case OnTimer function is get killed.

Dialog contain CaptureOn and CaptureOff button. when captureOn button is pressed that time SetTime function get invoked and CapStopWatch function is called, to calculate and display time(like stopwatch) and when i press the CaptureOff button then timer get killed.

If i press CaptureOn button and close the dialog that time OnTimer function automatically get killed. When same dialog invoked after, OnTimer called automatically, and its operate every slower(more than 1000 to 2000) but Initially i called set timer function with 100millisecond and i given code for your reference.
void CReplay::OnCaptureOn() 
{
   CapWatchID = SetTimer(CAP_STOPWATCH, 100, TIMERPROC);
}
void CReplay::OnTimer(UINT nIDEvent) 
{ 
  if(CapWatchID)
  {
     CapStopWatch();
   }
}
 
void CReplay::CapStopWatch()
{
    CString sTime;
    static clock_t tThisTime;
    static int TempSec=0;
    static int idelay=0;
 
    tThisTime = clock();
 
   dMin1++;
 
  if(dMin1 == 10) 
  {
     double TimeDiff = (double) ( tThisTime - tSimTime ) / CLOCKS_PER_SEC;
     TempSec = (int)TimeDiff;
 
    if( TempSec >= 60 )
    {
         niSec++;
         tSimTime = clock();
    }
    else
        niSec++;
 
    if( niSec >= 60 )
    {
        nMin++;
        niSec -= 60;
    }
    if( nMin >= 60 )
   {
        nHr++;
        nTotHr++;
        nMin -= 60;
        tSimTime = clock();
   }
 
     sTime.Format("%02d:%02d:%02d",nHr,nMin,niSec);
     iHrEnd = iCurHr= nHr;
     iMinEnd = iCurMin= nMin;
     iSecEnd = iCurSec = niSec;
 
     if(CaptureRunning == 1)
     {
        m_CaptureSW.SetFont(&StopWatchFont);
         m_CaptureSW.SetWindowText(sTime);
     }
    else if(ReplayRunning =1)
    {
        m_Elapsed.SetFont(&StopWatchFont);
        m_Elapsed.SetWindowText(sTime);
    }
  }
    if(nHr==12)
      nHr=0;
  }
 
   if(dMin1 >= 10)
    dMin1 =0; 
}


Kindly help me friends...


Regards
S.Shanmugaraja.
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
Jochen Arndt23-Feb-12 22:21
professionalJochen Arndt23-Feb-12 22:21 
QuestionRe: OnTimer function is killed automatically when the dialog is closed Pin
Richard MacCutchan23-Feb-12 22:24
mveRichard MacCutchan23-Feb-12 22:24 
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 23:28
shanmugarajaa23-Feb-12 23:28 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
Richard MacCutchan23-Feb-12 23:40
mveRichard MacCutchan23-Feb-12 23:40 
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht23-Feb-12 22:29
bjorn_ht23-Feb-12 22:29 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 23:37
shanmugarajaa23-Feb-12 23:37 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht24-Feb-12 1:22
bjorn_ht24-Feb-12 1:22 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa24-Feb-12 1:53
shanmugarajaa24-Feb-12 1:53 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht24-Feb-12 3:18
bjorn_ht24-Feb-12 3:18 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa24-Feb-12 19:49
shanmugarajaa24-Feb-12 19:49 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa26-Feb-12 20:16
shanmugarajaa26-Feb-12 20:16 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht26-Feb-12 22:31
bjorn_ht26-Feb-12 22:31 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa27-Feb-12 0:38
shanmugarajaa27-Feb-12 0:38 
SuggestionRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa27-Feb-12 17:49
shanmugarajaa27-Feb-12 17:49 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht28-Feb-12 21:38
bjorn_ht28-Feb-12 21:38 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa28-Feb-12 2:41
shanmugarajaa28-Feb-12 2:41 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht28-Feb-12 21:46
bjorn_ht28-Feb-12 21:46 

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.