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

Thread: Wm_notify

  1. #1
    Join Date
    Sep 2009
    Posts
    19

    Arrow Wm_notify

    I process WM_NOTIY in winproc to get what tab of a tab control the user choose

    (display a message box when a user click tabpage number 2 of a tab control of 4 pages)

    but the message box keeps poping up anoyingly and undeletable

    Thank you

  2. #2
    Join Date
    Sep 2009
    Posts
    19

    Re: Wm_notify

    I am lost.
    Can you just help me with what i lost ? that is my little happiness

  3. #3
    Join Date
    Sep 2009
    Posts
    19

    Re: Wm_notify

    this is my third post to inform the issue i am running into now
    could someone please ?

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Wm_notify

    We can't read your mind. How about posting, at least, the code for your WM_NOTIFY handler.

  5. #5
    Join Date
    Sep 2009
    Posts
    19

    Re: Wm_notify

    Thank you hoxsiew,

    Here is the code in a winproc
    Code:
    swith(message)
    {
       case WM_NOTIFY:
          if(m_tab.GetCurSel()==5)
          {
              AfxMessageBox(_T("Alert ! you press tab 5!"));
          }
       break;
    }

  6. #6
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Wm_notify

    So if two conditions are met: your tab control has tab 5 selected, and ANYTHING sends a WM_NOTIFY message; you'll get a message box. Can you see the problem?

  7. #7
    Join Date
    Sep 2009
    Posts
    19

    Re: Wm_notify

    I don't know what you are talking about.
    Hmmm, Ok, I wish to meet you somewhere, so you can state your helpful solution.

    My tab control hasn't been solved so far


    Edit: you don't need to continue posting anything in this thread. Let me be more stupid. I am already a fumb boy why do you need to help me know what I am wrong with

  8. #8
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Wm_notify

    I'm talking about the WM_NOTIFY message. There could be any number of controls sending notifications for a wide variety of reasons. You aren't discriminating amongst them at all. Whenever your loop gets a WM_NOTIFY, the only thing you are checking is the status of the tab control selection. The tab can be in a selected state for an indefinite period of time (until you select another tab) so during the time that tab 5 is the current tab, any other control that sends a WM_NOTIFY to your loop for any number of reasons, will cause a message box to pop up.

    Read up on the WM_NOTIFY message and pay close attention to the lParam; it is a NMHDR pointer in this case and it tells you a great deal of information on the control that sent it and why. If it is from the tab control and use that to determine if the message is of any interest to you. If it isn't sent from the tab control and if it isn't a TCN_SELCHANGE, then you probably don't want to pop up a message box.
    Last edited by hoxsiew; September 24th, 2009 at 09:50 PM.

  9. #9
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Wm_notify

    WM_NOTIFY
    Viggy

  10. #10
    Join Date
    Sep 2009
    Posts
    19

    Question Re: Wm_notify

    Quote Originally Posted by hoxsiew View Post
    I'm talking about the WM_NOTIFY message. There could be any number of controls sending notifications for a wide variety of reasons. You aren't discriminating amongst them at all. Whenever your loop gets a WM_NOTIFY, the only thing you are checking is the status of the tab control selection. The tab can be in a selected state for an indefinite period of time (until you select another tab) so during the time that tab 5 is the current tab, any other control that sends a WM_NOTIFY to your loop for any number of reasons, will cause a message box to pop up.

    Read up on the WM_NOTIFY message and pay close attention to the lParam; it is a NMHDR pointer in this case and it tells you a great deal of information on the control that sent it and why. If it is from the tab control and use that to determine if the message is of any interest to you. If it isn't sent from the tab control and if it isn't a TCN_SELCHANGE, then you probably don't want to pop up a message box.

    Thank you,
    Yes I also tried this

    Code:
    case WM_NOTIFY:
       NMHDR* p=(NMHDR*) lParam;
       if(p->idCode==TAB5_ID && 5==m_tab.Getcursel())
       {
          //showmessage;
       }
    No more message and it shows me nothing also!
    Where do you think I am coding incorrectly ?

  11. #11
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Wm_notify

    If I remember my messaging correctly (it's been a while since i played with this stuff), you recieve the WM_NOTIFY message *before* the tab actually changes. So, at the time you get the message, "GetCurSel()" will not return the tab you are switching to.

    Why not just check that you are getting the TCN_SELCHANGE message?

    Viggy

    PS. You can also stick a conditional breakpoint on your "if" line, so that it only breaks if "p->idCode == TAB5_ID". Then you can see what the currently selected tab is, to verify my statement.

  12. #12
    Join Date
    Sep 2009
    Posts
    19

    Re: Wm_notify

    Quote Originally Posted by MrViggy View Post
    If I remember my messaging correctly (it's been a while since i played with this stuff), you recieve the WM_NOTIFY message *before* the tab actually changes. So, at the time you get the message, "GetCurSel()" will not return the tab you are switching to.

    Why not just check that you are getting the TCN_SELCHANGE message?

    Viggy

    PS. You can also stick a conditional breakpoint on your "if" line, so that it only breaks if "p->idCode == TAB5_ID". Then you can see what the currently selected tab is, to verify my statement.
    Thank you, it works now.

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