WindowProc: combobox messages problem

In my CControlBar I have overridden the virtual WindowProc. The
combobox on the controlbar displays correct and behaves well in
runtime.

Now, I spent a couple of hours trying to get some messages that I need,
using WindowProc. This is needed because CControlBar will pass
everything on to the controlbar owner, and that's not what I want.
WindowProc is my way to intercept those messages.

I already found out that the messages are, ehm, weird: their numbers do
not match on related defines in winuser.h. To give an example:

WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is
defined as 0x0007. Q: what can be wrong?

Then, I want to get key events (key up). I want to know when enter is
pressed when the combo has focus. I find WM_COMMAND 0x0005 matches
(note, I TRACE every message WindowProc gets, not only WM_COMMANDs)
because it comes when releasing the key. However in winuser.h it is
defined as 0x0101. WM_KEYUP.

Besides that, one can take care of things better by handling CComboBox
notification messages, but I don't see *any* notification messages. Q:
why not? Did I forget something? (I looked through all styles for
comboboxes, etc.)

Another question: even if I could handle WM_KEYDOWN, where can I get
the code of the released key and find if the enter key that was
pressed?

I think I should get everything because I am handling in WindowProc. My
CWnd being a CControlBar should not be a problem.

Regards,

Ectoplasma

0
e_c_t_o (6)
12/26/2005 12:17:55 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
1123 Views

Similar Articles

[PageSpeed] 21

"ectoplasm" <e_c_t_o@hotmail.com> wrote in message
news:1135599475.665872.288650@o13g2000cwo.googlegroups.com...
> In my CControlBar I have overridden the virtual WindowProc. The
> combobox on the controlbar displays correct and behaves well in
> runtime.
>
> Now, I spent a couple of hours trying to get some messages that I need,
> using WindowProc. This is needed because CControlBar will pass
> everything on to the controlbar owner, and that's not what I want.
> WindowProc is my way to intercept those messages.
>
> I already found out that the messages are, ehm, weird: their numbers do
> not match on related defines in winuser.h. To give an example:
>
> WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is
> defined as 0x0007. Q: what can be wrong?

CBN_SETFOCUS perhaps?

>
> Then, I want to get key events (key up). I want to know when enter is
> pressed when the combo has focus. I find WM_COMMAND 0x0005 matches
> (note, I TRACE every message WindowProc gets, not only WM_COMMANDs)
> because it comes when releasing the key. However in winuser.h it is
> defined as 0x0101. WM_KEYUP.

CBN_EDITCHANGE maybe?

>
> Besides that, one can take care of things better by handling CComboBox
> notification messages, but I don't see *any* notification messages. Q:
> why not? Did I forget something? (I looked through all styles for
> comboboxes, etc.)

Don't understand. You are presumably getting CBN_xxx notifications.

>
> Another question: even if I could handle WM_KEYDOWN, where can I get
> the code of the released key and find if the enter key that was
> pressed?

Probably by subclassing the combo's child edit control and intercepting
WM_KEYUP.

>
> I think I should get everything because I am handling in WindowProc. My
> CWnd being a CControlBar should not be a problem.

You should not be expecting to receive WM_xxx messages for the combobox or
its constituent controls in the WNDPROC of its parent.
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
12/26/2005 12:49:49 PM
Jeff Partch [MVP] wrote:
> "ectoplasm" <e_c_t_o@hotmail.com> wrote in message
> news:1135599475.665872.288650@o13g2000cwo.googlegroups.com...
> > In my CControlBar I have overridden the virtual WindowProc. The
> > combobox on the controlbar displays correct and behaves well in
> > runtime.
> >
> > Now, I spent a couple of hours trying to get some messages that I need,
> > using WindowProc. This is needed because CControlBar will pass
> > everything on to the controlbar owner, and that's not what I want.
> > WindowProc is my way to intercept those messages.
> >
> > I already found out that the messages are, ehm, weird: their numbers do
> > not match on related defines in winuser.h. To give an example:
> >
> > WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is
> > defined as 0x0007. Q: what can be wrong?
>
> CBN_SETFOCUS perhaps?
>
> >
> > Then, I want to get key events (key up). I want to know when enter is
> > pressed when the combo has focus. I find WM_COMMAND 0x0005 matches
> > (note, I TRACE every message WindowProc gets, not only WM_COMMANDs)
> > because it comes when releasing the key. However in winuser.h it is
> > defined as 0x0101. WM_KEYUP.
>
> CBN_EDITCHANGE maybe?
>
> >
> > Besides that, one can take care of things better by handling CComboBox
> > notification messages, but I don't see *any* notification messages. Q:
> > why not? Did I forget something? (I looked through all styles for
> > comboboxes, etc.)
>
> Don't understand. You are presumably getting CBN_xxx notifications.
>
> >
> > Another question: even if I could handle WM_KEYDOWN, where can I get
> > the code of the released key and find if the enter key that was
> > pressed?
>
> Probably by subclassing the combo's child edit control and intercepting
> WM_KEYUP.
>
> >
> > I think I should get everything because I am handling in WindowProc. My
> > CWnd being a CControlBar should not be a problem.
>
> You should not be expecting to receive WM_xxx messages for the combobox or
> its constituent controls in the WNDPROC of its parent.
> --
> Jeff Partch [VC++ MVP]

I think I made some wrong assumptions. All the messages I got all were
WM_COMMAND messages. I mean, I use:

if (message == WM_COMMAND)

So, it seems the CBN notifications are WM_COMMAND? I thought they would
come as message == WM_NOTIFY or maybe WM_NOTIFYPARENT. I mean I was
just experimentally looking which actions cause which messages, and
keystrokes came as WM_COMMANDs, not control notification messages.

And I see now... I looked through winuser.h, looking for 0003, while in
fact it's there simply as 3... my mistake!

Lastly. I was hoping a control sends each keypress to its parent? Not
so? Because I want to know when the user presses enter: that's the time
I will take the input from the control and perform some work. I was
hoping to avoid subclassing controls. I fear I am wrong again.

Anyway, thanks for the help mr. Partch.

Ectoplasma

0
e_c_t_o (6)
12/26/2005 4:16:36 PM
I think I made some wrong assumptions. All the messages I got all were
WM_COMMAND messages. I mean, I use:

if (message == WM_COMMAND)

So, it seems the CBN notifications are WM_COMMAND? I thought they would
come as message == WM_NOTIFY or maybe WM_NOTIFYPARENT. I mean I was
just experimentally looking which actions cause which messages, and
keystrokes came as WM_COMMANDs, not control notification messages.

And I see now... I looked through winuser.h, looking for 0003, while in
fact it's there simply as 3... my mistake!

Lastly. I was hoping a control sends each keypress to its parent? Not
so? Because I want to know when the user presses enter: that's the time
I will take the input from the control and perform some work. I was
hoping to avoid subclassing controls. I fear I am wrong again.

Anyway, thanks for the help mr. Partch.

Ectoplasma

0
e_c_t_o (6)
12/26/2005 4:16:49 PM
"ectoplasm" <e_c_t_o@hotmail.com> wrote in message
news:1135613809.163078.313510@z14g2000cwz.googlegroups.com...
> I think I made some wrong assumptions. All the messages I got all were
> WM_COMMAND messages. I mean, I use:
>
> if (message == WM_COMMAND)
>
> So, it seems the CBN notifications are WM_COMMAND? I thought they would
> come as message == WM_NOTIFY or maybe WM_NOTIFYPARENT. I mean I was
> just experimentally looking which actions cause which messages, and
> keystrokes came as WM_COMMANDs, not control notification messages.
>
> And I see now... I looked through winuser.h, looking for 0003, while in
> fact it's there simply as 3... my mistake!
>
> Lastly. I was hoping a control sends each keypress to its parent? Not
> so?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/comboboxes/specialcomboboxfeatures.asp
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
12/27/2005 1:22:07 AM
Thanks.

msdn:
"...messages specifically handled by the predefined COMBOBOX class
window procedure."

so I will have to subclass the CComboBox anyway to be able to handle
WM_CHAR (or WM_KEYDOWN). Well ok.

Another question about the message map (I couldn't find on MSDN,
neither could I figure out the #defined macro behind it):

Now in my CControlBar I am intercepting the messages that I want to
handle, using WindowProc. What should I do to make the messages being
handled by the message map (within BEGIN_MESSAGE_MAP /
END_MESSAGE_MAP)? This will be more convenient than having to write big
switch statements etc. to route messages to methods.

Kind regards,

Ectoplasma

0
e_c_t_o (6)
12/27/2005 2:35:27 AM
To answer my last question by myself:

to use the message map, I make my WindowProc as follows:

LRESULT MyControlBar::WindowProc(...)
{
    if (message == WM_COMMAND && wParam > 1)
    {
        // Handle all WM_COMMANDS locally (in message map)
        return CWnd::WindowProc(...);
    }
    return CControlBar::WindowProc();
}

It means we just bypass CControlbar and use normal CWnd behaviour.
CControlBar would send messages to the owner window (which is
CMainFrame, right) and this is not desirable to say the least. (That
is, in my case. It is understandable for a usual CControlBar, though).

0
e_c_t_o (6)
12/27/2005 3:05:50 AM
"ectoplasm" <e_c_t_o@hotmail.com> wrote in message
news:1135650927.551131.78370@g47g2000cwa.googlegroups.com...
> Thanks.
>
> msdn:
> "...messages specifically handled by the predefined COMBOBOX class
> window procedure."
>
> so I will have to subclass the CComboBox anyway to be able to handle
> WM_CHAR (or WM_KEYDOWN). Well ok.
>
> Another question about the message map (I couldn't find on MSDN,
> neither could I figure out the #defined macro behind it):
>
> Now in my CControlBar I am intercepting the messages that I want to
> handle, using WindowProc. What should I do to make the messages being
> handled by the message map (within BEGIN_MESSAGE_MAP /
> END_MESSAGE_MAP)? This will be more convenient than having to write big
> switch statements etc. to route messages to methods.

ON_CBN_xxx or ON_WM_xxx or ON_CONTROL or ON_MESSAGE or...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_message_handling_and_mapping_topics.asp

-- 
Jeff Partch [VC++ MVP]


0
jeffp (1712)
12/27/2005 3:07:01 AM
Reply:

Similar Artilces:

Stuck messages
Looks like a lot of people have the same problem of large messages not leaving their mail boxes. Anyone have an answer - it's driving me crazy!! Thanks Corinne Corinne, As an engineer, I have come across this many a times. Some solutions have and some haven't. It seems to be a protocol related issue (between NT kernel and Outlook/IE/OE) Suggestions: 1. Try another SMTP server 2. Increase the server time-out value in your account settings 3. Change the MTU value in registry for adapter http://www.winguides.com/registry/display.php/280/ 4. Try with Outbound mail scanning disab...

Message Rule Problem
I set two message rules, the first one for messages containing [IncrediJoy], and the other for messages containing [Blank-Tags-ONLY] for the messages to go into specific folders. For some reason, when I get more of the messages with [IncrediJoy] or [Blank-Tags-ONLY], they won't go to their assigned folder, how can I correct this problem? -- Matthew Surber matthew_surber@earthlink.net Have A Great Day! -- All Outgoing mail scanned by McAfee ...

Shared workbook and VBA problem
Shared workbook and VBA problem Hi Group, I am new at this Excel stuff and I am hitting my head on a silly problem that I am sure many have seen before. I wrote a very simple spreadsheet where I use the Calendar control to pick some dates. Everything was fine until I decided that I needed to share it on the network with other users. As soon as I share it the calendar control stops working. I get a "runtime error 1004, unable to set left property of oleobject class". That's because the first thing I try to do is position the calendar. If I don't do that, it still doesn't...

money 2005
I originally had money 2004 and had no problems getting my credit scores updates automatically. Ever since I upgraded to 2005, I get the following error: This error happens instantaneously. "Money is unable to access Experian at this time, possibly becuase of server problems. Please try again later" I can contact experian directly without any problems. It's a bug. This seems to effect those upgrading from Money 2004 to Money 2005. The only workaround is to manually visit the experian website and log in. If you are trying to sign up for the free service with Experia...

remote connect to exchange server message question
Hello all, If using Outlook 2002 on Windows XP at home, and using a dsl VPN connection to connect to your offices Exchange Server 2000; and when setting up the connection at home the very first time you accidentally uncheck the "leave messages on server" button; and then all the messages from exchange server at the office are downloded to your home machine; and then when you get to the office all your messages are gone (becaouse they are at home); how do you change this back at home, so all the messages won't be downloaded to the home machine? I have been through every set...

ComboBox messages
I have a ComboBox that I want to do some special processing while the dropdown menu is down. I know I can get a notification of CBN_DROPDOWN, but that only tells me when it is first dropped down. I need to determine the selection the mouse is currently over in the drop down menu, so I can update a help balloon on the screen that will then describe what that choice will do. (The user is choosing from various styles, and the balloon will give a short description of what each style is like.) How can accomplish this end? Is there a message I can grab that will tell me the mouse has mov...

Problem with external data web query
Hello I have an Excel spreadsheet that obtains data from the internet. It is updated daily. In all there are 42 separate web queries on my spreadsheet. They all download almost identical tables of identical sixe (7C x 50R) If I choose to update each morning by using the <Refresh All> button on the External Data Toolbar then problems occur. Most notably, some data are not downloaded. About 7 queries out of the 42 have faults. If I update manually (i.e. go to each table in Excel and right click and select <!Refresh> then the success rate is much higher. Still, and more ...

Automated way to move messages to a non-outlokk folder
I need an automated way to move messages from an inbox to a non-outlook folder saved as .msg files. See the MailItem.SaveAs method. -- Best regards Michael Bauer - MVP Outlook Category Manager - Manage and share your categories: SAM - The Sending Account Manager: <http://www.vboffice.net/product.html?lang=en> Am Mon, 26 Apr 2010 10:04:06 -0700 schrieb STMII: > I need an automated way to move messages from an inbox to a non-outlook > folder saved as .msg files. ...

total # of messages
Is there a way to display the total number of messages beside the folder What version of Outlook? In Outlook 2003 you can display the total number of items by right clicking on the folder and choosing Properties. There are option buttons for displaying the total number of items or the total number of unread items. Other versions of Outlook do not have this capability. -- Patricia Cardoza Outlook MVP www.cardozasolutions.com Author, Special Edition Using Microsoft Outlook 2003 ***Please post all replies to the newsgroups*** "Apple" <anonymous@discussions.microsoft.com> wr...

Journaling sent messages only
Hi All I am trying to configure Exchange 5.5 Journaling so that messages that have been sent either internally or externally will go to the journal mailbox - I have heard that this is possible but the detail is elusive. I have the same requirement for an Exchange 2k3 server but not as urgent- any help would be gratefully recieved Thanks for your help jc (the famous jc from Southsea [old] hampshire jc@archivingxchange.co See http://support.microsoft.com/?id=239427 You need to look at the section regarding routing local messages through the MTA. For E2k3 see this: http://www.msexchange.o...

hyperlinks in messages
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop <i>cannot figure out how to embed a hyperlink in a particular word in my email message</i> On 3/21/10 10:21 PM, DaidGNA@officeformac.com wrote: > pop /cannot figure out how to embed a hyperlink in a particular word in > my email message/ Entourage does not have this function built in. Make Hyperlinks X By: Paul Berkowitz <http://scriptbuilders.net/> This script makes proper hyperlinks (live underlined words in ordinary text that open linked web pages) in...

WindowProc: combobox messages problem
In my CControlBar I have overridden the virtual WindowProc. The combobox on the controlbar displays correct and behaves well in runtime. Now, I spent a couple of hours trying to get some messages that I need, using WindowProc. This is needed because CControlBar will pass everything on to the controlbar owner, and that's not what I want. WindowProc is my way to intercept those messages. I already found out that the messages are, ehm, weird: their numbers do not match on related defines in winuser.h. To give an example: WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is def...

Cannot edit old hyperlinks in outlook messages...
I opened an old outlook message, selected resend this message. then proceeded to change some of the hyperlinks behind some of the text... Every time I changed it, then selected ok, it reverted back to the old hyperlink. I had to remove the hyperlink then recreate it... Bug. ...

sent messages stuck in outbox
Hi, I'm frustrated trying to figure out why my sent messages don't go to the sent mail folder. instead, they just stay in my outbox. this is a relatively recent phenomenon and I want it to stop. I'm using outlook 2000 and windows 2000. any help would be greatly appreciated. thanks ------------------------------------------------ ~~ Message posted from http://www.OutlookForum.com/ ~~ View and post usenet messages directly from http://www.OutlookForum.com/ Hi: Try checking the tools/options/prefences/email options: Be sure that there is a check in the box by "Saved copi...

Not receiving test messages
Outlook 2002 on Windows2000 workstation. 1. When I test the settings on one of my accounts, everything tick itself OK but I get no test email. 2. I test another account using a different mail server and everythin works OK. 3. I cannot send any email to the mail server in 1., but I can receiv it. 4. I can send and receive mail to anyone not on the mail server in 1. with no problems. 5. When my account is set up on a friends machine - it works n problems. I have uninstalled my spam program (SpamBully), and have turned off m firewall and antivirus program ---------------------------------...

questiion about using <All> in a combobox
hello I have a form with a combobox having Row Source: SELECT qryF.FID, qryF.FName FROM qryF ORDER BY qryF.FID ASC; 'FID is autonumber, FName is text When I click a command button, a Report opens. The Report is based on qryAtt and has FILTER: FID = Forms!frmAtt!cboSelectF. All of this works perfectly. Next I added <All> to the form's combobox by changing the Row Source to: SELECT qryF.FID, qryF.FName FROM qryF UNION SELECT "*", "<All>" FROM qryF ORDER BY qryF.FID ASC; My problem is with how to get the ...

Problem with Outlook XP
Greetings, Recently I did the dreaded 98 upgrade to XP on a legacy machine I have. For outlook, I found that office 2000 was extremely buggy post upgrade so I uninstalled and installed a spare copy of Office XP I had. Now, on this machine, and this machine only, I constantly get the following: Task 'Microsoft Exchange Server' reported error (0x80040111): 'The server is not available. Contact your administrator if this condition persists.' Email still functions as normal however the error is rather annoying. I can't find anything in the KB related. Any input woul...

Addind email address problem
I am having a terrible time trying to add an email to outlook. Please help me :P LOL Once I have all the information in and click test I get a pop up with this information: Enter Network Password: Server: User Name: Password: Then you can click ok or cancle. This has the information I put in for the email account information. What do I do? If I click ok it just keeps coming up. If I click cancel it won't work. Thanks for any help :) If this is for company email, contact your IT people. If it's for home use, give us your internet provider (ISP) name. Someone may be able to g...

Junk Mail problems
Apparently my domain address has been "hijacked" and I've gotten hundreds of messages in the last 24 hours using different id's to the left of the @ sign for my domain name. Most of the junk comes to me as "Undeliverable" or "System Administrator" returned mail. Of course it's replies to nothing I've ever sent out. Anyway, is there something I can set up in Outlook 2000 that will automatically send anything that comes to ???? @mydomain.com to the trash and just let the stuff specifically addressed to myname@mydomain.com stay in the inb...

Rules problem on Server
Hi everyone, We have a problem where emails are being deleted without being read. I believe that this is a rules problem from the Exch Server, running Exch2003. Problem began when working with rules on the journal mailbox we use for archiving. The message will flash in the recipients mailbox and then disappear. No trace of it remains on the recipient side. Sender sees a reply that that the messag was deleted without being read. So far I have: Upgraded rules Delted rules in Outlook Deleted rules on Exchange using MDBVU32 Problem seems to happen randomly. Easy to test because I have ...

How to get all TRACE messages?
I would like to get all TRACE messages (including those of main message pump), not necessarily in the DEBUG window. I am working under MSVC6. Usually, when there are many TRACE messages, some messages are lost. Moreover, the DEBUG window is very slow. Is it possible? Pierre Couderc Pierre Couderc wrote: > > I would like to get all TRACE messages (including those of main message > pump), not necessarily in the DEBUG window. > > I am working under MSVC6. > Usually, when there are many TRACE messages, some messages are lost. > Moreover, the DEBUG window is very...

Filtering Messages
Hello I know that I can use the rules wizard to filter my emails to a specific folder... no problem I know that I can filter based on a date. However, is there a way to filter based on a date 3 days from the present date? I have an archive folder, and what I want to do is to automatically take all messages that are older than 3 days and place them into my archive folder. Can I do this? If so, how? Outlook 2000 Thank you so much Terry V ...

how to add WindowProc to VS2005 dialog
yo, How do I add a WindowProc to a VS2005 dialog project? I have expanded the CDialog->BaseTypes->CWnd->WindowProc. and double click on WindowProc and it is not added to my project. newbie Why would you need to? Please explain. joe On Fri, 8 Jun 2007 11:44:49 -0700, "Allan" <mmress@hotmail.com> wrote: >yo, > >How do I add a WindowProc to a VS2005 dialog project? > >I have expanded the CDialog->BaseTypes->CWnd->WindowProc. >and double click on WindowProc and it is not added to my project. > >newbie > > > Joseph M....

Unread Message in Public Folders
Hello, the bold number next to Public Folders, showing the number of unread messages, does not match the number of actual unread messages in the folders. I have tried uninstalling and reinstalling Office 97 but this did not fix it. Any ideas? Thanks. Randy What happens if you refresh the view? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After searching google.groups.com and finding no answer: Randy <anonymous@discussions.microsoft.com> asked: | Hello, the bold number next to Public Folders, showing the | number of unread messag...

Problem changing downloaded transactions in Money 2007
I have upgraded from Money 2004 to Money 2007. I am having a very annoying problem when I download transactions from my bank. In 2004, whenever I downloaded transactions, they would be automatically matched up with transactions I had already entered into my register. Then I was given the option to accept this downloaded transaction or change it. The problem I'm having is two fold. First, the downloaded transactions never match up with one that I have already entered into the register manually. The times that it does match up with a transaction, it does so with some future tran...