CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Posts
    15

    CListView and WM_TIMER

    I'm having a problem getting a WM_TIMER message to work with a CListView object. If I derive my object from a CView all is fine. As soon as I switch over to the CListView, the timer hits the first couple of times, then never again. The odd thing is that if I just click my mouse in one of the cells in the CListView's ListViewCtrl, then a WM_TIMER comes in.

    Any ideas?

    Thanks,
    Curt



  2. #2
    Guest

    NOT the answer, I also want to know

    Hi,

    I have had the same thing happened to me. I put a AfxMessageBox() inside my OnTimer() and only for the first couple of times it displayed, afterwards nothing. What's up with CListView?

    I'd like to know what the reason and work-around is.

    Good luck.



  3. #3
    Join Date
    Jun 1999
    Posts
    15

    Re: NOT the answer, I also want to know

    I ended up sorting this one out myself. My original OnTimer looked something like:



    void MyClass::OnTimer (int nEvent)
    {
    MessageBeep(0);

    CListView::OnTimer(nEvent);
    }





    I don't have the code in front of me so don't hold me to the syntax... Anyway, I ended up replacing that with this:



    void MyClass::OnTimer (int nEvent)
    {
    if (nEvent == MY_EVENT)
    MessageBeep(0);

    else
    CListView::OnTimer(nEvent);
    }





    I actually ported this app from a dialog-based app that had that first OnTimer and everything worked fine. But I found that - I guess - if you call the CListView's OnTimer with an event that it's not expecting, it gets heartburn. I tried singlestepping into it once and ended up with an access-vio. Since I was in a hurry to get this app done and onto to other stuff, I was just happy to get it to run.

    Force be with you.

    Curt





  4. #4
    Join Date
    Apr 1999
    Posts
    5

    Re: CListView and WM_TIMER

    I have found the problem is that the listview eat the timer message but I don't know the solution yet.
    I suggest you setting the timer process to do the same thing on SetTimer(,,,TimerProc).


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