Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Timer Problem

Timer Problem

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NewVC
    wrote on last edited by
    #1

    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.

    C CPalliniC H 3 Replies Last reply
    0
    • N NewVC

      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.

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      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. <

      1 Reply Last reply
      0
      • N NewVC

        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.

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        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]

        In testa che avete, signor di Ceprano?

        N 1 Reply Last reply
        0
        • CPalliniC CPallini

          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]

          N Offline
          N Offline
          NewVC
          wrote on last edited by
          #4

          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

          CPalliniC 1 Reply Last reply
          0
          • N NewVC

            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.

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            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 )

            1 Reply Last reply
            0
            • N NewVC

              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

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6
              • Please check the posted code (for instance use &lt; 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 the OnStopTimer 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]

              In testa che avete, signor di Ceprano?

              S 1 Reply Last reply
              0
              • CPalliniC CPallini
                • Please check the posted code (for instance use &lt; 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 the OnStopTimer 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]

                S Offline
                S Offline
                SandipG
                wrote on last edited by
                #7

                Also i think he is not passing correct id to KillTimer.. :)

                Regards, Sandip.

                CPalliniC 1 Reply Last reply
                0
                • S SandipG

                  Also i think he is not passing correct id to KillTimer.. :)

                  Regards, Sandip.

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  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]

                  In testa che avete, signor di Ceprano?

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups