-
September 22nd, 2009, 07:30 PM
#1
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
-
September 22nd, 2009, 07:34 PM
#2
Re: Wm_notify
I am lost.
Can you just help me with what i lost ? that is my little happiness
-
September 22nd, 2009, 08:41 PM
#3
Re: Wm_notify
this is my third post to inform the issue i am running into now
could someone please ?
-
September 23rd, 2009, 07:55 AM
#4
Re: Wm_notify
We can't read your mind. How about posting, at least, the code for your WM_NOTIFY handler.
-
September 23rd, 2009, 07:06 PM
#5
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;
}
-
September 23rd, 2009, 09:16 PM
#6
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?
-
September 24th, 2009, 08:48 PM
#7
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
-
September 24th, 2009, 09:44 PM
#8
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.
-
September 25th, 2009, 03:42 PM
#9
-
September 25th, 2009, 08:25 PM
#10
Re: Wm_notify
Originally Posted by hoxsiew
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 ?
-
September 28th, 2009, 02:50 PM
#11
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.
-
September 28th, 2009, 09:07 PM
#12
Re: Wm_notify
Originally Posted by MrViggy
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|