Messages from Children ?

Hi guys,

What's the best way to handle this: I have a CWnd derived class that I use
as a child window in either a dialog box or a CWnd-derived view; and I want
to handle mouse message that occured within the child.

I can put mouse messages (OnLButtonDown, etc.) in the child then route them
to the parent but then parent won't know which child sent it. Or, I can make
a custom mouse handler in the parent, like OnChildLButtonDown() that the
child would call with it's ID but that seems a little sloppy. I'd like to do
it like the notification messages other controls send like CEdit; for
example, in my dialog class I have
ON_EN_KILLFOCUS(IDC_EDIT_1,OnKillFocusEdit1) which is nice because I know
which edit box sent the message.

Thanks.


0
2/27/2004 5:05:47 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
363 Views

Similar Articles

[PageSpeed] 27

You can do it the same way other controls do it. Send a WM_COMMAND message to the parent
with a notification code appropriate for your control. You can add ON_CONTROL handlers to
handle these notifications.

GetParent()->SendMessage(WM_COMMAND, (WPARAM)MAKELONG(MYN_CLICKED, GetDlgCtrlID()), 
                   (LPARAM)m_hWnd);

[check the order of those two WPARAM operands; I'm working from memory here and may have
inverted them]

ON_CONTROL(IDC_NAME, MYN_CLICKED, OnNameMyClicked)

void CMyDialog::OnMyNameClicked()
   {
   }


Note that you should change the names from the silly "EDITn" type names to something that
makes sense for your app, e.g., the edit control above holds a name.
					joe

On Fri, 27 Feb 2004 17:05:47 GMT, "Robert A." <invalid@invalid.org> wrote:

>Hi guys,
>
>What's the best way to handle this: I have a CWnd derived class that I use
>as a child window in either a dialog box or a CWnd-derived view; and I want
>to handle mouse message that occured within the child.
>
>I can put mouse messages (OnLButtonDown, etc.) in the child then route them
>to the parent but then parent won't know which child sent it. Or, I can make
>a custom mouse handler in the parent, like OnChildLButtonDown() that the
>child would call with it's ID but that seems a little sloppy. I'd like to do
>it like the notification messages other controls send like CEdit; for
>example, in my dialog class I have
>ON_EN_KILLFOCUS(IDC_EDIT_1,OnKillFocusEdit1) which is nice because I know
>which edit box sent the message.
>
>Thanks.
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
2/28/2004 5:44:00 AM
Reply:

Similar Artilces:

Error message: Office cannot connect to the internet
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel When trying to use the translate function in the reference tools, office gives the error message &quot;Office cannot connect to the internet&quot; I know for a fact that my computer is connected to the internet so I am left very confused. Your computer very well may be connected to the internet but apparently it isn't sharing that resource with Office... Check the settings in System Preferences for the applications, Firewall & User Account. Once they're set correctly run Disk Utility - Rep...

FP Can't Close Table Message
Does anybody know what causes the FP Can't Close Table message and how to prevent it? Additionally, what does "FP" mean? Thanks -- Charles Allen, MVP FP means "Forms Processor." The subsystem within Dynamics that processes the controls, tables and business logic associated with each form within Dynamics. The reasons for FP's in-ability to close a table can vary widely. If you have a reproducable problem (i.e. it occurs regularly) you should discuss the problem with Dynamics support. "Charles Allen" wrote: > Does anybody know what causes the...

Reading pane does not match message list
I've been using WLM desktop for a over a year with no problems at all. I just had to do a complete recovery on my PC, including an update to WLM 2009, which meant doing an export / import. All seemed to go fine. But, as of this morning many of my storage folders, but not all, show all the correct messages in the message list, but the reading pane always shows the same message. I first thought that it was the result of the import process, but I see that even messages I moved to the folders this morning are behaving the same way. I've even rebooted the PC, but I still ...

Error Message #8
When responding to a email that has been received, word will give notice that and error has occured and to I want it to send an error report or not and then shuts down word without saving. This happens several times a day and I can not find anything within the knowledge base as to what may be causing this and how to fix it. I have done all available updates thinking that might correct it but it did not. Please help! ...

Unified Messaging, play WAV in Entourage... HOW?
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: Exchange Hi, just trying to get Entourage to play the .wav files created by Exchange UM. At the moment, I've unchecked WAVE as a MIME type supported in Quicktime and also -in a desperate attempt to do it the &quot;Mac&quot; way- done a &quot;get info&quot; on a .wav file in the Finder and changed it to open with Entourage. <br><br>Except it still opens with iTunes; meanwhile, in the Entourage mail window it sees the attachment, but doesn't offer &quot;play&qu...

Allow save copies of message option to be set by account
Hello, I'm using IMAP for the first time, but also have POP3 accounts with no IMAP support in Outlook 2007. I want to save a single copy of my sent messages, after they are actually sent. I can't do this in OL 2007, or at least if I can, without a bunch of rules tinkering and/or negating a benefit of IMAP. I don't like the rules setup, because it sends a copy of my POP3 e-mail to the sent items folder when I hit the send button, not when the e-mail is actually sent. I'd like to have the ability to set the option of saving copies at the account level. Now, either I can...

Message Tracking Center doesn't work in XP
Hi, Exchange System Manager (e2k3 and all tools of server 2003 and Exchange 2003) works fine on Windows XP professional, without tracking center. If I type in all parameters (sender or recipient and server) it starts searching, and will never end. This was the same before migrating to Exchange 2003 (i. e. servers and all tools from version 2000). I've tried to install all tools on a new XP machine - the tracking center doesn't work at all. If I use a windows 2000 professional workstation, the tracking center (2000) works fine and gives result in a few seconds. What may be the rea...

I get a file in use message telling me that the file is locked ?
This is a one user computer and the file is not being used. The box containing the error message says "FILE IN USE". If I reboot I can get into the file once only before having the same error message. I have tried saving the file under a different file name but that file acts the same. I have checked permisions and that is not the problem either .....HELP! ...

Error message - cannot log into Outlook
I tried to open an email last night and my computer just stopped -- then a box popped up that says: " This program has performed an illegal operation and will be shut down." "If the problem persists, contact eh program vendor." [with a "close" and "Details" box] I can't get it to go off -- it keeps popping up even after I've shut down my computer (but it won't let me shut down properly -- I have to just hold in the button on the CPU until it shuts down. HELP I can get on the internet and everything else -- but I can't ge...

Can't delete email messages
After i received about 300 worm emails, I can not delete any of the emails i have received. When I hit the delete key, I get the following error message " The message interface has returned an unknown error. If problem persists, restart outlook". I have Norton Anti Virus, and I have verified that my machine is free of Virus. Even though I have restarted Outlook many times, the problem persists. Any suggestions. thanks for the help Bob Yeary Bob@Yeary.net Oh woe is me. Regardless if you using an ISP or exchange server. Create a new pst file. Move the message you want ...

Can't install update KB9532957...see below message for particulars
I STILL can't install: Microsoft.NET Framework 1.1 Service Pack 1 Security Update for Windows XP (etc) and Windows Server 2008 R2 ( KB953297 ) More and more system blocks and failures are occuring... PLEASE HELP !!! Many thanks in advance! See the "How to obtain help" section of http://support.microsoft.com/kb/953297 For home users, no-charge support is available by calling 1-866-PCSAFETY (and/or 1-866-234-6020 and/or 1-800-936-5700) in the United States and in Canada or by contacting your local Microsoft subsidiary. There is no-charge for support c...

External messages problem
Hi all, I have this problem with a customer, they have an Exchange 2003 Server (SBS2003). The external mailboxes resides on the ISP so they download messages to internal mailboxes through POP3 connector. This works fine but we see 2 problems: 1) When an internal user wants to send messages to an external user the mail is sended with the "reply-to" pointing to the internal mailbox (not resolvable from internet), so when the external user wants to reply and sends the email the address is not recongnized and the email bounces. 2) If we change the "reply-to" to match the...

Exchange 2003 Message size limits not working
Hi, we have 2 Exchange 2003 SP1 Cluster for Mailboxes and 2 Bridgehead Server for SMTP transfer. I have to grow up the maximum message size limit for attachments to 20 MB / 20480 KB. I set the limits described in knowledge base article 322679. In detail : Global setting : send & recive : 50000 kB SMTP Connector setting : 20480 kB SMTP virtual server setting : SMTP bridgehead server : 20480 kB mailbox cluster server : 50000 kB User mailbox setting : unlimited I send a 17 MB pdf file from a user on the mailbox cluster and I get an error: <xxxxxxx #5.2.3 smtp;450 5.2.3 Msg Size ...

Internet Message Filter updates?
I love this so far -- it seems to work great. My understanding is that it uses the SmartScreen technology where hotmail users mark mails as spam, and it updates itself, "learning" new spam. Will there be updates as the spammers work to get around these filters? I'd even be happy downloading updates weekly by hand if it helped reduce spam for my users. -Ken Curtis ken +at+ kencurtis +dot+ net or curtiske -at- lynnschools -dot- org My understanding is that updates will be made available, not sure on the frequency of them. -- Mark Fugatt Exchange MVP http://www.exchangetraine...

Public Folder messages stuck in Messages Pending Submission queue
We recently added a replica of our PF to a new server and phased out the old server (it is still up, but with no PFs). We now periodically see our Messages Pending Submission queues (on a variety of servers in the forest) backing up with public folder messages with a subject of Hierarchy. Any ideas what might be happening? - jc ...

Want to send message from Outlook/Exchange where reply does not work
I have been asked by my boss to find a way in which he can send a message to an Exchange distribution group in such a way that the recipient cannot reply to it (as he calls it "a one-way message"). Does anyone have any suggestions? ...

Message displays funny coded...
When some of us send an message, sometimes message becomes like below. ====================== charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I'm = done working for=20 the day but I will take care of this tomorrow, since I have all the = latest=20 TMs.. Robyn=20 ======================= Or sometimes when we send an html page from IE 6.0, the person will receive the page showing no pictures or anything but source code looking staff. This doesn't happen all the time. It happens once a while. Does anybody know why and how to fix this? Most of our employe...

What message is posted when moving mouse over CEdit?
What message is posted when moving mouse over CEdit? I would like to implament a tooltio which is displayed when the mouse is moved over a control derived of CEdit. Therefore I would like to ask you if someone know what message I have to capture in order to call my finction displayinn the tooltip? Can someone help? And perhaps someone knows what should be done to enable tooltips for controls derived of CEdit? I have a dialog and implement the following method: BOOL COptionPricingFooterForm::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult) everything works fine as long as my memebe...

Outlook 2002 error messages
I use MSN for email but I do send a lot of mail out of Outlook 2002 SP3. In Outlook I constantly get the error message 0x80040115. It says the task could not be completed, even though the email eventually got sent. It talks about a network connection but this laptop computer is a stand alone. How can I fix this error problem? ...

childrens weekly chores roster template
i am searching for templates for my children. I need a weekly roster for chores around the house. Days columns and about 15 rows. Any help would be great. Thanks There is no template for chores that I know of but it shouldn't be difficult to construct a bespoke one. Reconstruct my address and send me an e-mail and I will see if I can help. Regards Sandy -- to e-mail direct replace @mailinator.com with @tiscali.co.uk "shanelle" <shanelle@discussions.microsoft.com> wrote in message news:B79F1B25-2A0D-4932-9757-31E1F4C7F545@microsoft.com... > i am searching for te...

Opening a message crashes outlook
When I try to open a message to read, outlook 2003 crashes. If I right click on the message to forward or reply, it works fine. Anyone else have this problem before? Dwight ...

Number of messages processed for mailbox 'nnn': 0
When I use exmerge to export to a pst, I don't get any errors but the pst file is only 32kb where it should be nearly 30 mb. below is the exmerge.log: Number of messages processed for mailbox 'ROSADELA ASTUDILLO': 0 [17:10:31] Number of folders processed for mailbox 'ROSADELA ASTUDILLO': 0 [17:10:31] Successfully completed copying mailbox 'ROSADELA ASTUDILLO' to file 'F:\PST\ (5-7-2005)\RASTUDILLO.PST'. [17:10:32] Copying data from mailbox 'AGENOR OLIVARDIA' ('AGENORO') on Server 'xxx-xxx' to file 'F:\PST\ (5-7-2005)\AGENORO....

Deleting messages
I am unable to delete Entourage messages. I have accumulated over 400 messages and would like to get rid of them -- one at a time is insane and setting up groups and then deleting the group doesn't work either. How? Would like to convert to Mac Mail but unable to locate were to switch preference -- Help Thanks Eddeavila ...

Custom notification message
Hi ! I wrote my own list box control inherited from CListBox. My question is: How can I define a custom notification message like LBN_SELCHANGE, LBN_SELCANCEL ? I want the owner window to trap this message. Thanks! bumbala@gmail.com wrote: > Hi ! > > I wrote my own list box control inherited from CListBox. My question > is: How can I define a custom notification message like LBN_SELCHANGE, > LBN_SELCANCEL ? I want the owner window to trap this message. > > Thanks! > #define MY_LISTBOX_MESSAGE (WM_APP+1) -- Scott McPhillips [VC++ MVP] I defined the message bu...

Rules not forwarding over SMTP connector--- messages in Categorizer
I have a development network with one Exchange 2000 server. The exchange org is connected by an SMTP connector to a SUN server running an Oracle mail app. If I manually create an email from any Exchange recipient to any Sun recipient, it is successfully delivered; same for if I manually forward from Exchange to SUN. But if I create an outlook rule to either forward or redirect to the SUN recipient, it does not work. I can see the forwarded-by-a-rule emails in message tracking; they go all the way to the Categorizer but once they are submitted to the Categorizer, no further activity. I'm st...