Where my custom message handlers are added in MFC?

When we add message handler for controls(For Ex. Ok button->OnOk())
then where the framework map this message with the given handler...

Whether all the handlers are added with windproc's switch case? or
somewhere else? where(in which file) could i see this in MFC?

Thanks,
Raa

0
12/20/2006 6:32:47 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
409 Views

Similar Articles

[PageSpeed] 7

The handlers are done with files that are typically at the top of the 
program files.   Some of the handlers (like OnOK) are handled by default 
inside of MFC, but can be overridden if you want to do special processing.

Tom

"RajanM" <Rajan.Munuswamy@gmail.com> wrote in message 
news:1166596367.117923.285800@79g2000cws.googlegroups.com...
> When we add message handler for controls(For Ex. Ok button->OnOk())
> then where the framework map this message with the given handler...
>
> Whether all the handlers are added with windproc's switch case? or
> somewhere else? where(in which file) could i see this in MFC?
>
> Thanks,
> Raa
> 


0
tserface (3861)
12/20/2006 7:26:11 AM
RajanM wrote:
> When we add message handler for controls(For Ex. Ok button->OnOk())
> then where the framework map this message with the given handler...
> 
> Whether all the handlers are added with windproc's switch case? or
> somewhere else? where(in which file) could i see this in MFC?
> 
> Thanks,
> Raa
> 

The switch case is in CWnd::OnWndMsg, in the file wincore.cpp.  You can 
see this easily, and the processing that calls it, if you set a 
breakpoint in any message handler function.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
12/20/2006 2:59:49 PM
There is no switch on these messages.  The only switch statement in AfxWndProc deals with
how certain messages are routed.  So if AfxWndProc finds a WM_COMMAND message it initiates
the command routing mechanism.  Otherwise, all that happens is a loop that starts at the
first entry of the most-contained-class's message map, looks for a handler, if it doesn't
find it, it goes to the superclass handler, if it doesn't find it, proceeds upward to the
base class of the window.  If it doesn't find it there, it then goes to the next target of
the message routing.

The simplest way to see this in action is set a breakpoint at AfxWndProc and start
single-stepping code.  You can learn a lot from an hour or so spent in this way.  The more
you use step-into, the more you will learn (although after a while, you can step-over,
because doing this for EVERY message will wear real thin).  

You can read the code in wincore.cpp, but that isn't nearly as informative as
single-stepping through it a couple times.  Some of it is a bit difficult to understand
because you don't understand the premises on which it is built until you see how it runs.
					joe

On 19 Dec 2006 22:32:47 -0800, "RajanM" <Rajan.Munuswamy@gmail.com> wrote:

>When we add message handler for controls(For Ex. Ok button->OnOk())
>then where the framework map this message with the given handler...
>
>Whether all the handlers are added with windproc's switch case? or
>somewhere else? where(in which file) could i see this in MFC?
>
>Thanks,
>Raa
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15978)
12/21/2006 3:40:38 PM
Thanks a bunch to all you Guys!
Regards,
Raa

RajanM wrote:
> When we add message handler for controls(For Ex. Ok button->OnOk())
> then where the framework map this message with the given handler...
>
> Whether all the handlers are added with windproc's switch case? or
> somewhere else? where(in which file) could i see this in MFC?
> 
> Thanks,
> Raa

0
12/26/2006 2:12:46 PM
Reply:

Similar Artilces:

Adding a second criteria to indirect Sumproduct
Sorry for all the questions lately - this project is really testing my skills :S I have a formula I'm using to SUMIF multiple data across various sheets: =SUMPRODUCT(SUMIF(INDIRECT({"18","19","20","21","22","23","24"}&"! B16:B300"),A15,INDIRECT({"18","19","20","21","22","23","24"}&"! W16:W300"))) However, I'm looking to add a second criteria to this. Right now the data in range B16:B300 has to match A15, but I also nee...

Custom Entity Relationship CRM 3.0
I have created a new custom entity (A) for which I need to create two referential relationships to other custom entities (B) & (C). (A) is the primary entity in both cases. The relationship between (A) and (B) acts normally. The relationship between (A) and (C) doesn't. When I try to add a (C) record from (A), (A) displays two records in the (C) lookup. One "record" displays data from system fields (created on and status). The second "record" displys data from the primary field. I am not able to access (C) record from the associated view in (A), but I can a...

Adding users to address books
I was hoping to have a user be a member of two separate address books. Does anyone know if this is possible. Any help greatly appreciated. Thank you. One user can be the member of multiple address lists as long as the user meets the criteria specified in the filter of each address list. "Rio" <anonymous@discussions.microsoft.com> wrote in message news:20da101c45a0f$09a4c8a0$a301280a@phx.gbl... > I was hoping to have a user be a member of two separate > address books. Does anyone know if this is possible. > Any help greatly appreciated. > Thank you. ...

Custom toolbar and macros
I am moving a user from Windows 2000 to XP and he has a worksheet with many custom Macros as well as the custon toolbar with it. We can move the worksheet and the macros will move with it. The problem is moving the custom toolbar with it. How do I get the toolbar to move along with the worksheet. One way: With the custom workbook active, choose Tools/Customize/Toolbars. Click Attach. Attach your custom toolbar to the workbook. In article <F0FC2885-07CB-4706-BC67-DEB7B664BACF@microsoft.com>, "MD" <MD@discussions.microsoft.com> wrote: > I am moving a user fro...

Messages bounced
I am curious why my messages are getting taken off the server. I have been trying to find out why I can not get perfmon to connect and I have sent 2 different messages on differet groups (not at the same time) and they are getting taken off the server. I know they are being taken off the server because one of the times the message was there, then an hour later it was gone. My reader said the message was no longer on the server. There is no inflammatory language but clearly something is wrong. Does anyone know why this would be happening? Thanks, Tom Your post r...

Overriding constraint violation message
Hi I'm at my first try to use SQL Server as back-end database for Access front-end. On SQL Server, I created constraints (additionally to primary key) for my tables: a) foreign key constraints to control data integrity (deleting entries linked to other tables isn't allowed); b) check constraints (certain fields or combination of fields must be unique). It works all fine in access, but when those constraints are triggered, the message returned to access is a mess for an average user. Is there a way to replace those messages with my own, p.e. like: "Del...

toolbar customization
533 MHz Power PC G4 384 MB SDRAM MAC OS X 10.3.3=20 Office X: Excel 10.1.5 (Service Release 1) When I drag command buttons to Excel's Standard Toolbar I get grayed-out = icons as follows: Hide Detail Show Detail Insert Rows Ironically the following buttons, dragged in precisely the same = fashionto the=20 Standard Toolbar, work satisfactorily: Insert Columns Delete Column Delete Row Any suggestions? Has MS discoveed and repaired these bugs for the May=20 2004 updates? While they're not bugs, they are confusing. You probably dragged the Insert Rows button from the Edit categ...

CRM Customization: Display Contact Info on Service Activity Form
We'd like to be able to open a service activity, and display all of the associated contacts' information (name, phone, address) on the same form. We have attempted to use IFRAMEs to load this information, but have so far been unsuccessful in achieving the desired effect. What is the best approach to take here? I am trying to do the same... What I really want is: 1) Service activity calendar view to show the customer name, number and address in the mouseover 2) When a service calendar item is clicked on, I would like the contact name, address and telephone listed in the main fo...

adding email accounts #3
How do I add other e-mail accounts to Office word 2007? To add email accounts to Outlook 2007, go into Tools, Account Settings and click New Patrick Schmid -------------- http://pschmid.net "Red4Con1" <Red4Con1@discussions.microsoft.com> wrote in message news:DE62EEFE-3DC4-4E11-8935-AC724AB2DFD3@microsoft.com: > How do I add other e-mail accounts to Office word 2007? You don't add email accounts to Office Word 2007. It is a word processor, not an email program. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All...

Tracking customer orders when receiving stock
With our current POS system we can place items on order for a particular customer (whether we are holding the stock or not) and when we generate purchase orders the system automatically pops up letting us know we have pending orders for customers. We can then generate a purchase order based on this information. When we receive the stock, we can print out a report for that order that lists what stock needs to be allocated to which customers. Is there a way with RMS that we can do this? Unfortunately it is a regular occurance that our stock levels can be incorrect, for instance we may have a 0 ...

Exchange 2003
Does anyone know when the Exchange 2003 Intelligent Message Filter will be available? http://www.microsoft.com/exchange/techinfo/security/imfoverview.asp We do have current SA on our Exchange and CALs, and our local MS Office and reseller don't know anything about it. Thanks in advance. Hopefully soon! On Mon, 3 May 2004 08:22:20 -0600, "Research Services" <key@lamar.n0-sp@m.colostate.edu.NO> wrote: >Does anyone know when the Exchange 2003 Intelligent Message Filter will be >available? >http://www.microsoft.com/exchange/techinfo/security/imfoverview.asp >...

Message-ID in headers?
Hi Is it possible to reconfigure the message-ID which Exch 2003 includes in outgoing mail headers? Our message-ID reveals our internal AD domain name, as well as the Exch server's internal AD computername. I would prefer the message-ID to include our public DNS domain name. Thanks FV On Fri, 29 Jul 2005 09:27:28 +0100, "fv" <sdfs@dfd.com> wrote: >Hi > >Is it possible to reconfigure the message-ID which Exch 2003 includes in >outgoing mail headers? Our message-ID reveals our internal AD domain name, >as well as the Exch server's internal AD computern...

Customize Does not WOrk
When I clip the customize outlook today button, it does not respond. Anyone have an idea of what the problem might be? Posted several times a day here: OL2000: You Cannot Customize Outlook Today After You Install Critical Update 813489 for Internet Explorer: http://support.microsoft.com/default.aspx?scid=kb;EN-US;820575 -- Russ Valentine [MVP-Outlook] "Glenn" <anonymous@discussions.microsoft.com> wrote in message news:05cb01c3cc7b$467a26c0$a101280a@phx.gbl... > When I clip the customize outlook today button, it does > not respond. Anyone have an idea of what the pr...

Instant Messaging Exch 2K
Exchange Server 2K (on win2k - sp4). Instant messaging has never been enabled, but we'd like to add this capability. We have a Citrix Farm (95% of users on Teleclients), with Win2k Citrix terminal servers all locked in at win2k sp3. Will Instant Messaging require all to be at win2k sp4? Thanks in advance. If you have any plans to move to Exchange 2003, instant messaging is not supported in this version. Why get the users into something, only to take it away? Greg "Chuck" <user@inter.net> wrote in message news:vrmo51lmhope02d9vg280ut4apqoe6j57i@4ax.com... > Excha...

C00D11B3 error message
I have been using Media player for years, now have ver. 11, in the past two day, I have had a problem if I go to player and play some music stored on the hard drive, it works. I f I attempt to play something on the internet I get the error and then it won't play anything until I reboot the system. I thought it was a firewall issue, but can't figure out what it would be. I also have checked connect to the internet override, without success. I have recently changed routers to a linksys with Network Magic set to basic. I have no idea what is causing the issue. -- J P...

Finding messages from a particular domain
I'm trying to find all messages where the From address contains a particular domain (e.g., @microsoft.com). I'm on an Exchange Server. Putting a domain name in the From field on this will only work if it's from someone outside my organization. How can I search for all messages from other users of my Exchange Server? Is there no one here that can help me with this? "Gary Holeman" <garyholeman*NOSPAM*@letu.edu> wrote in message news:O4Ezdw$lDHA.688@TK2MSFTNGP10.phx.gbl... I'm trying to find all messages where the From address contains a particular domain ...

Adding + in front of a number
I have a column of numbers which represent a change in value over the previous year. I want to have a + in front of the number if it's a positive change. Let's say my first number is 500. My problem is that I can write something like, if(a1>0,"+"&a1), but when then I can't format the number. If the number is in the millions I can't provide a comma as a thousand separator and I cannot tell it how many decimal places I want to show. Is there a really easy way to do that, or do I have to write a huge formula to precisely spell out the formatting within...

How to display HTML in Custom Task Pane
Does anyone know if it is possible to program a custom task pane in Office 2007 (using VSTO) to display hosted web content (i.e. HTML). How about locally stored HTML? My team is looking at ways of providing modest on-screen assistance to support our custom Add-in that docks nicely within the application and can be coupled with a few controls. If it's not possible, we're stuck using CHM. Thanks in advance. ...

error message #73
When opening certain mails in MS Outlook 2000 we are receiving the following error. "Can not open item. The instruction can not be completed because the service function does not support this instruction". I did translate the previuos message from dutch, so I am not 100% sure that the englishe message is the same. The dutch message is "kan het item niet openen. Kan de bewerking niet voltooien omdat de servicefunctie de bewerking niet ondersteunt". When having the prevouis message you can not open mail, resend. The only action is the remove it from your inbox fol...

XY Scatter with Custom Labels
I have a list of products, each with an X (a dollar amount) and a value (a percentage). Is it possible to have each point labeled with custom value i.e.: Printer, or Digital Camera, rather than it bein labeled with just the values being plotted ($1,000, 2% or $500, 7%)? Any ideas are appreciated. Thanks, Keit -- hatzipe ----------------------------------------------------------------------- hatzipet's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2789 View this thread: http://www.excelforum.com/showthread.php?threadid=47392 You can edit the text of a labe...

Phantom message header and reminders
My hard drive recently had some corruption (bad sectors), which I fixed using CheckDisk. I then used the Inbox Repair Tool (ScanPST) to repair the file which was unfortunately in the corrupted part of the disk. [I have Outlook 2003 SP1 (11.6359.64080, running on Windows XP Pro SP2] For the most part, I am able to use the PST file, and I haven't found too many things to have been lost. However, I have some annoying "ghost" objects: In my "Unread Mail" search folder, I see the header of an unread message that was apparently lost due to the corruption. I can'...

Change dates to a custom format via formula ... how to?
Hello, A2 has formula =NOW() which makes date today in this format: Tue.Apr.26.2011 How can I get my custom date formats so that the above date shows up as Tu.Apr.26.2011. In another sheet, I was kindly given this to make these types of changes: =IF($A$2<>"",TEXT($A$2,"yymmdd.")&CHOOSE(WEEKDAY($A$2),"Sn","Mn","Tu","Wd","Th","Fr","Sa"),"") I tried this, =NOW()&CHOOSE(WEEKDAY($A$2),"Sn","Mn","Tu","Wd","Th","Fr","Sa&...

Undeliverable Message
Hi Everyone I have a small network of about forty workstations, with an SBS 2003 Server and Exchange 03. I am getting messages from "Administrator" (addressed both to Administrator, and my personal mailbox which is where the administrator messages are re-routed to) with hundreds of email addresses bouncing back. The messages are of varying errors, for example mailbox@domain on 9/05/2005 9:46 AM The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system admi...

Need some advice from MFC gurus???????
I am creating an accounting application. I will have a menu called Maintain that will have MenuItems like Customer, Supplier, Inventory. I would like to have the capability to have all 3 open at once on the desktop is needed. I want to have a windows menu that will list all the open windows and the ability to cascade and tile and close all. I am going to override New and Open to be able to create a new company or open another company not create or open a new document. I am thinking about creating an MDI app with a document for each window ex. CustomerDoc, SupplierDoc, InventoryDoc. The do...

Customer Report
Hello, I am hoping someone might assist me with a problem. I am trying to customize a customer report to show the Notes from the customer file. It has been suggested to me to run a query on this to pull the info I want. This is great, but not ideally what I am looking for. I want anyone in the office to be able to run the report and filter it to their specifications. For example: we have an anual catalogue and we do not send it to everyone on our mailing list. We want to send it to local customers who have spent money with us or who specifically request a catalogue. We have used up all ...