CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    WM_TIMER Not coming to the Window

    I have set a Timer for 100 ms using SetTimer fn. It returns non zero value but WM_TIMER message is not coming to the window.
    It's not coming to the OnTimer at all. I have also used spy to view WM_TIMER message. Spy also didn't get any WM_TIMER message for that wnd.
    If anybody have any clue, pl help. Thanks in advance.


  2. #2
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: WM_TIMER Not coming to the Window

    Hi.

    Check the following.
    1) Where did you put SetTimer func?
    -> OnCreate or OnInitDialog is better.

    2) Did you add WM_TIMER message to your message handler?

    HTH.
    -Masaaki Onishi-


  3. #3
    Guest

    Re: WM_TIMER Not coming to the Window

    I have put it in OnCreate only. Any other idea, pl Help.
    ----Mythili


  4. #4
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: WM_TIMER Not coming to the Window

    Hi.

    afx_msg void OnTimer(UINT nTimerID);

    ///////////////////////////////////////
    BEGIN_MESSAGE_MAP(CMainWindow, CFrameWindow)
    ON_WM_CREATE()
    ON_WM_TIMER()
    END_MESSAGE_MAP()

    int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
    {
    .....................
    if(!SetTimer(ID_TIMER, 100, NULL)) {
    MessageBox("Error: SetTimer failed");
    return -1;
    }
    return 0;
    }

    void CMainWindow::OnTimer(UINT nTimerID)
    {
    your job
    }

    I assume that you don't use callback function.
    Define ID_TIMER 200(whatever) at resource.h
    Or directly use some number at SetTimer.

    HTH.
    -Masaaki Onishi-







  5. #5
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: WM_TIMER Not coming to the Window

    What window, what type of the application? Could you be more specific?

    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured