Re: SetTimer and WM_TIMER?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 11/04/04


Date: Thu, 04 Nov 2004 18:53:19 -0500

O.B. wrote:
> I see many posts about problems with SetTimer but not a solution that
> fits my case.
>
> I have a SDI program in VC++ v6. In the "View" class constructor, I have:
> ::SetTimer(0, 0, 200, 0)
>
> I added a message handler using the "Class Wizard" to handle WM_TIMER
> events. However, that handler never gets invoked.
>
> What's wrong with my syntax? Is there additional code I must add?

Try actually giving it the first argument:

   ::SetTimer(m_hWnd, ...

and don't do it in the c-tor, do it in the 'OnCreate', where 'm_hWnd' is
already valid.

V



Relevant Pages

  • Re: SetTimer and WM_TIMER?
    ... > I see many posts about problems with SetTimer but not a solution that ... > fits my case. ... The constructor is too early. ... You need a valid HWND for SetTimer to ...
    (microsoft.public.vc.language)
  • Re: SetTimer and WM_TIMER?
    ... >>I see many posts about problems with SetTimer but not a solution that ... >>fits my case. ... > The constructor is too early. ... You need a valid HWND for SetTimer to ...
    (microsoft.public.vc.language)
  • Re: SetTimer() & callback handler
    ... SetTimer was written way back when the Windows World was young, and C++ hadn't yet swept the world ... What criterion should be used to associate a timer callback with a MomPC instance? ... when the handler runs btn_timer ...
    (microsoft.public.vc.language)
  • Re: String manipulation
    ... trying to find something that would work for me in the 1,670 posts ... discussing word wrapping. ... If its less, add more characters, ... and just count down until it fits. ...
    (microsoft.public.vb.general.discussion)
  • Re: Damn it. No triple crown winner
    ... it fits right in with your posts in this thread. ... something so stupid as the justification you've offered in this thread? ... I don't care if you are bothered or not. ...
    (rec.sport.football.college)