unwanted WM_TIMER

This is a discussion on unwanted WM_TIMER within the Windows Programming forums, part of the Platform Specific Boards category; I have a listview in my program, and i noticed that everytime when i select an item from the listview, ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    76

    unwanted WM_TIMER

    I have a listview in my program, and i noticed that everytime when i select an item from the listview, 1 sec later a WM_TIMER msg is sended to the listview. Where does this come from, and how can i disable it?

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Quote Originally Posted by johny145
    I have a listview in my program, and i noticed that everytime when i select an item from the listview, 1 sec later a WM_TIMER msg is sended to the listview. Where does this come from, and how can i disable it?
    Let's see the code for your message handler.
    Away.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    shure....


    Code:
        while(GetMessage(&msg,0,0,0))
        {
            if(LOWORD(msg.message) == WM_TIMER && hChMapDlgListView && msg.hwnd == hChMapDlgListView) // disable WM_TIMER on listview
            {
                /* SKIP */
            }
            else if(LOWORD(msg.message) == WM_TIMER && msg.hwnd == listviewHandle)// disable WM_TIMER on listview
            {
                /* SKIP */
            }        
            else if(hChMapDlg && (TranslateAccelerator (hChMapDlg, hAccelTable, (LPMSG) &msg ) ||
                                   IsDialogMessage (hChMapDlg,(LPMSG) &msg)) )
            {
                /* SKIP */
            }
            else if ( TranslateAccelerator(hwndMain, hAccelTable, (LPMSG) &msg ) || IsDialogMessage (hwndMain,(LPMSG) &msg) )
            {
                /* SKIP */
            }
            else
            { 
                TranslateMessage(&msg);
                DispatchMessage (&msg);
            }
        }
    Last edited by johny145; 06-25-2005 at 08:33 PM.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    The timer is created and owned by the list-view. If you don't want the timer, get rid of the list-view. Why is it causing you distress?

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    I use the shortcut ctrl+a to select all items. Lets say you click on the listview and then do a quick ctrl+a to select everything. Everything gets selected and then the wm_timer comes by, and the items that has the focus gets selected again. I dont know why, but it seems a wm_timer sets the selection back to the item that has the focus. I also removed the focus from all items, but then nothing gets selected. As you can see i did some hacking in the messageloop, and now it doesnt happen anymore. But i would rather have the wm_timers not showing up at all.

    Is there any reason why the listview makes a wm_timer, and how bad is it to block them from the listview?

  6. #6
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    *bump*

    Is there any reason why the listview makes a wm_timer, and how bad is it to block them from the listview?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. unwanted Variable Change
    By purebuu in forum C Programming
    Replies: 3
    Last Post: 02-21-2006, 07:56 PM
  2. unwanted number in switch
    By chrismax2 in forum C++ Programming
    Replies: 5
    Last Post: 04-24-2004, 05:43 AM
  3. unexpected ( unwanted ) output in a file
    By Rpog in forum C Programming
    Replies: 2
    Last Post: 04-15-2004, 07:33 AM
  4. How to get rid of an unwanted function return value?
    By RedZippo in forum C++ Programming
    Replies: 4
    Last Post: 03-22-2004, 02:42 PM
  5. Unwanted space inbetween characters
    By SAMSAM in forum Windows Programming
    Replies: 4
    Last Post: 01-25-2003, 11:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21