Thread: very bad delay in picking up WM_MOUSEMOVE

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    114

    Talking very bad delay in picking up WM_MOUSEMOVE

    I set my dialog proc to pick up WM_MOUSEMOVE

    in my dialog proc :
    Code:
    BOOL CALLBACK MenuProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
        switch(Message)
        {
            case WM_INITDIALOG:
    			{
    
    
    			}
    			break;
            return TRUE;
    
    
    			
    		case WM_MOUSEMOVE:
    			{
    				MessageBox(NULL, "mouse is IN!", 
    					"GOOD",MB_ICONEXCLAMATION | MB_OK);		
    			}
    			break;
    .....
    mouse is IN!" messagebox come only after about 5 seconds of my mouse constantly moving in the window area. This is bad because i need immediately response. I have no idea how the 5 seconds delay come about. I ran spy++ to check on the messages sent to the dialog and they were all fine and constant flowing

    any idea what's going on??

    using
    - win98se
    - vc++6.0
    - API style of coding

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You're causing your dialog proc to recurse infinately...
    Code:
    case WM_MOUSEMOVE:
    {
        static bool showing = false;
    
        if (!showing)
        {
            showing = true;
            MessageBox(NULL, "mouse is IN!", "GOOD", 
                       MB_ICONEXCLAMATION | MB_OK);		
            showing = false;
        }
    }
    break;
    gg

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    Thnx for reply
    why am i causing it to recurse repeatly??
    is it because of
    MessageBox(NULL, "mouse is IN!", "GOOD",
    MB_ICONEXCLAMATION | MB_OK); ??

    i tried the code you provided but it still doesnt solve the problem of the delay...
    i used this
    Code:
    		case WM_MOUSEMOVE:
    			{
    				static bool showing = false;
    				if (!showing) // if it's false
    				{
    					showing = true;
    					OutputDebugString("mouse is IN!\n");	
    					showing = false;
    				}
    			}
    			break;
    what happens is that OutputDebugString("mouse is IN!"); causes the string "mouse is in" to be displayed onto the debugging section of vc++6.0 everytime it picks up the WM_MOUSEMOVE message

    still... the unwanted delay is there. What would be expected would be a very quick repeated strings occurring non-stop everytime i move my mouse on the client area

    I ran Spy++ to spy on the messages sent to the window and saw a non-stop repeated string of mousemove messages flowing.

  4. #4
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Hmm shouldn't you return 0?
    Code:
    case WM_MOUSEMOVE:
    {
      MessageBox(NULL, "mouse is IN!",  "GOOD",MB_ICONEXCLAMATION | MB_OK);		
    return 0;
    }
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    ok guys, this might be rather interesting....
    Code:
    BOOL CALLBACK MenuProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	char tempx[10];
    	tempx[0] = '\0';
    	_itoa( Message , tempx, 10);
    	strcat(tempx,"\n");
    
    	OutputDebugString(tempx);
    
    	
    
    
    
        switch(Message)
        {
    							
    
    
            case WM_INITDIALOG:
    			{
    
    
    			}
    			return TRUE;
    	//	break;
    
    		case 32:
    			{
    					OutputDebugString("mouse really moved");	
    			}
    			break;
    					
    		case WM_MOUSEMOVE:
    			{
    					OutputDebugString(" WM_MOUSEMOVE message picked up");	
    			}
    			break;
    i changed wm_mousemove to int 32 and it worked!! no more delays. Strange huh?? anybody knows why?

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Which message do you get?
    'mouse really moved' or 'WM_MOUSEMOVE message picked up'?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Registered User Russell's Avatar
    Join Date
    May 2004
    Posts
    71
    Why do you insist on posting Windows Programming in the non-Window Programming forum?

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    32  == WM_SETCURSOR
    512 == WM_MOUSEMOVE
    The fact that WM_SETCURSOR is propagated to the parent window while WM_MOUSEMOVE is not makes me think that you are moving the mouse over a child control and that is why you are not getting WM_MOUSEMOVE in the parent.
    Last edited by anonytmouse; 05-28-2004 at 01:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Shocking(kind of)
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 12-10-2002, 08:52 PM
  2. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM
  3. Bad File number?
    By Unregistered in forum Linux Programming
    Replies: 4
    Last Post: 05-31-2002, 08:55 AM
  4. good news and bad news
    By Garfield in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 10-27-2001, 07:31 AM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM