case WM_UNDOCUMENTED: ...

This is a discussion on case WM_UNDOCUMENTED: ... within the Windows Programming forums, part of the Platform Specific Boards category; Interesting discovery. A little background: I was attempting to streamline my message loop so that it ignores unwanted messages. So ...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,657

    Exclamation case WM_UNDOCUMENTED: ...

    Interesting discovery. A little background:

    I was attempting to streamline my message loop so that it ignores unwanted messages. So I added all the desired messages to the "wanted" list, and ran the program.
    Result? The program would not close.
    So I decided to print out all messages not on my list. There were four to speak of, namely:

    163 (WM_NCLBUTTONDBLCLK)
    161 (WM_NCLBUTTONDOWN)
    162 (WM_NCLBUTTONUP)
    280 (???)

    It turns out, the first three were my problem. The 'x' was in the non-client area.

    But the fourth one, though apparently harmless, was nowhere to be found in any of my header files. So with a little experimenting, it became apparent that the last message was sent whenever the mouse hovers over the title bar. Question: does anyone else have this value defined in their headers? Try this:
    #define FOUND_IT 280
    If the compiler complains, then you do.
    It may just be a newer message than my compiler's documentation covers...but interesting nonetheless, and I have added a new entry to my winuser.h!



    ITSA
    Socket Library!

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    LOL....thats's a coincedence!!!!


    I have put out the firt version of a spy++ clone I have written - here , and I noticed it kept spitting out this 280 message, but it wouldt interpret it as a known message!! And I cant find it anywhere

    There are some messages that are user defined, but they are usually higer than WM_USER (that's how best to define your own messages!).

    But this one is lower than WM_USER (0x0400), and its used a lot....


    I'm still looking for the answer....if I get it I'll come back. Likewise if you strike lucky, I wouldnt mind knowing either

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    is that really speeding you up that much not to call TranslateMessage and DispatchMessage? hmmm interesting

    The one thing I would as is are you calling DefWindowProc for the ones you're ignoring? That would cause a problem if you weren't
    always looking, make an offer. get me out of this place.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Congratulations, Sebastiani, on the discovery of this hitherto unknown species. As its discoverer, the honour of naming it goes to you. What will you call it?

    >>Fordy: spy++ clone I have written<<

    Great in win2k (thanks for the new toy ). Dies in win98. I've emailed details.

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Ken Fitlike

    Great in win2k (thanks for the new toy ). Dies in win98. I've emailed details.
    Thanks for the feedback..

    Damn....I havent got a Win98 box to test this on (have tried to purge all 95 & 98 boxes out of my life )...I tried it on 2000 and in work on my XP machine, and as it worked I didnt think twice......

    In your email, you say its when you drag onto another window.....hmm....I'll have to try find a Win98 box to fix it.......

    As to your suggestions thanks again, I am planning to add to the app, this is just a first version....

    A message filter is badly needed I know and it will be the next addition as soon as I get round to it.

    Thanks again!

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>when you drag onto another window<<

    I just tried it again; the cursor is good until it either leaves the main app window or enters the client of the edit(?) control that occupies most of the bottom half of the main window.

    >>I'll have to try find a Win98 box to fix it<<

    Post here,fd or your site - i'd be happy to test it out if that would help.

    (Alternatively you could always just build for UNICODE and pop up a 'die win98 scum' dialog box..)

  7. #7
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,657
    I call it WM_HOVERTITLEBAR but that may be wordy for some. Call it what you like

    Ken: could you cout << me one? Pleeeeze?

    [/code]
    is that really speeding you up that much not to call TranslateMessage and DispatchMessage?
    certainly.

    The increased speed can be substantial, dependent on such factors as relative volume in the system, the types of messages , and the processor speed.

    Below is an example message pump.
    I implement it as a list that serves as a filter. This structure is quite lean, composed of nothing more than a UINT and a forward and backward pointer. All messages are loaded into the list either by default, by semi-default, or manually, depending on the type message. For instance, you would'nt normally ignore a WM_CLOSE message would you? In my lists, all messages can be removed though. A window class inserts elements in and out of the list by request into the message stream. Custom message patterns can be created, recorded and modified too. Enjoy.







    Code:
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    
    
    
    
    WPARAM RunMessageLoop()
    {
     int recieving;
    
     while(recieving = GetMessage(&messages, NULL, 0, 0) != 0)
     {
       if(recieving == -1)
        {
         Alert("              Fatal Windows Error           ");
         return recieving;
        }
    
       if( messageTracker.Has(messages.message) )  //...the rest won't even make it to the window procedure!!
        {
         DispatchMessage(&messages);
    
         TranslateMessage(&messages);
    
         SendMessage(hwnd, messages.message, messages.wParam, messages.lParam);
        }
        // /else Alert("New Message: %d", messages.message); / //
    
     }
    return messages.wParam;
    }
    
    
    
    
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    
    
    
    void AddDefaultMessages()
     {
      AddMessage(WM_NCCREATE);
      AddMessage(WM_CREATE);
      AddMessage(WM_PAINT);
      AddMessage(WM_SIZE);
      AddMessage(WM_NCLBUTTONDOWN);
      AddMessage(WM_NCLBUTTONUP);
      AddMessage(WM_NCLBUTTONDBLCLK);
      AddMessage(WM_KEYUP);
      AddMessage(WM_KEYDOWN);
      AddMessage(WM_LBUTTONDOWN);
      AddMessage(WM_RBUTTONDOWN);
      AddMessage(WM_LBUTTONUP);
      AddMessage(WM_RBUTTONUP);
      AddMessage(WM_DESTROY);
      AddMessage(WM_CLOSE);
      AddMessage(WM_QUIT);
      // / etc
     }
    
    
    
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    
    
    
    bool AddMessage(UINT message)
     {
      if( messageTracker.Has(message) )   //...already has message...
        return false;
    
    
      messageTracker.Push(message);
    
      return true;
     }
    
    
    
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    
    
    
    bool RemoveMessage(UINT message)
     {
      List <UINT> *messageFound = messageTracker.Has(message);
    
      if(messageFound == NULL)      //...didn't find message...
       return false;
    
      messageTracker.Remove(messageFound);
    
      return true;
     }
    
    
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//



    ITSA
    Socket Library!

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Great, from now on:

    #define WM_HOVERTITLEBAR 0x0118 /*Sebastiani: cprog winforum Aug 2002*/


  9. #9
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Oooo, Fordy - Lovin' the new toy. Could be pretty useful for debugging...I didn't think that Spy++ could log messages though? Is that a fordy-original?

  10. #10
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Oops, just found the logging thing....how very useful...

  11. #11
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    I have

    in AFXTRACE.cpp
    "pMsg->message == 0x0118) // WM_SYSTIMER (caret blink)"

    and
    in THRDCORE.CPP
    "// WM_PAINT and WM_SYSTIMER (caret blink)
    return pMsg->message != WM_PAINT && pMsg->message != 0x0118;"

    So looks like it is the 'claret blink timer'. Can't find an actual #def for WM_SYSTIMER.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault!?!?!?
    By Viper187 in forum Windows Programming
    Replies: 57
    Last Post: 10-02-2008, 09:40 PM
  2. Format Precision & Scale
    By mattnewtoc in forum C Programming
    Replies: 1
    Last Post: 09-16-2008, 10:34 AM
  3. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  4. Creating pop up menus
    By Ti22 in forum C++ Programming
    Replies: 22
    Last Post: 01-18-2005, 08:27 PM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM

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