Where do my CWnd message go?

Where does my CWnd message go?

When I click the scrollbar, in the  overwritten OnVScroll I call a method 
putting a command in the queue of my worker thread.  My worker thread 
executes the command and post a message on a hidden window created in the GUI 
thread. But the message never arrives.  Where does it go?

This works perfectly if I click a button in the toolbar, then a command is 
put in the queue of the worker thread which execute the command and post a 
message back on the hidden window when it is finished.  The hidden window is 
created in a class derived from CWnd.  The messages received is interpreted 
and handled by the overwritten PreTranslate.

I know that the message is posted for sure.
So my question is:
In which cases will a message not arrive where you expect it to arrive?  How 
can I find the message?
Is it handled somewhere else?  I think it must be related to the scrollbar 
in some way because it only happens when I send commands to the worker thread 
when I click the scrollbar.

The hidden window does not have a parent window set in CreateEx.

Happy for some feedback.

Regards Kjell Arne Johansen

0
3/25/2008 9:12:02 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
866 Views

Similar Articles

[PageSpeed] 23

See below...
On Tue, 25 Mar 2008 14:12:02 -0700, Kjell Arne Johansen
<KjellArneJohansen@discussions.microsoft.com> wrote:

>Where does my CWnd message go?
>
>When I click the scrollbar, in the  overwritten
****
That's "overridden".  "Overwritten" suggests that the code has been written on top of. The
concept in C++ is called "override".
****
> OnVScroll I call a method 
>putting a command in the queue of my worker thread.  
*****
What does the method do? 
*****
>My worker thread 
>executes the command and post a message on a hidden window created in the GUI 
>thread. 
****
Show the code!  Have you used the debugger to make sure that you are actually posting the
message where you think you are posting the message?
****
>But the message never arrives.  Where does it go?
****
Show the code!  We have NO IDEA what you have done!  What does your message map for your
hidden window have?  Is it a Registered Window Message?  There's no way to tell what your
code looks like via ethereal vibrations.
****
>
>This works perfectly if I click a button in the toolbar, then a command is 
>put in the queue of the worker thread which execute the command and post a 
>message back on the hidden window when it is finished.  The hidden window is 
>created in a class derived from CWnd.  The messages received is interpreted 
>and handled by the overwritten PreTranslate.
****
Overriding PreTranslateMessage for this purpose is poor style.  Why would you choose such
a poor method for handling a message?  The message map exists for this purpose!
****
>
>I know that the message is posted for sure.
>So my question is:
>In which cases will a message not arrive where you expect it to arrive?  How 
>can I find the message?
****
If you post it, it will arrive.  Therefore, there  is some other bug in your code.
****
>Is it handled somewhere else?  I think it must be related to the scrollbar 
>in some way because it only happens when I send commands to the worker thread 
>when I click the scrollbar.
****
Without seeing the code, there is no way to tell
****
>
>The hidden window does not have a parent window set in CreateEx.
****
A parent is not required; in fact, what you have done is a common technique, except for
the erroneous use of PreTranslateMessage to solve a simple problem.  If it is not working,
you've done something else wrong, but without seeing code, it is hard to guess.

You're really certain you get the queue entry posted?

I suspect the PreTranslateMessage hack is improperly done.  First thing I'd suggest is
getting rid of it entirely and using the message map.  Until that is done, I wouldn't
attempt to debug the code, since it is probably wrong in ways that cannot be fixed.
				joe
****
>
>Happy for some feedback.
>
>Regards Kjell Arne Johansen
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
3/26/2008 3:18:53 PM
Thank you for responding to my request Mr. Newcomer.
Yes I know there is a lack of details.
I did not want to bother people with too many details if it was possible 
from a short overview to give me some general information on where to look.  
Some obvious things about windows message handling that I should look into.

The code in question is really old and has been living in our system for 
many years and working fine.

Due to the architecture of this particular part of the code PreTranslate has 
been overridden.  The specific message is checked for in PreTranslate.

I hoped that my information about that this problem only occurs when I click 
the scrollbar should be enough information.  E.g “if you click the scrollbar 
then your message will be routed to the scrollbar and you have to…”.

I will prepare a more detailed description and come back later with ha new 
question.

Regards Kjell Arne Johansen 
sw engineer.
0
3/27/2008 1:43:00 PM
PreTranslateMessage does not apply to all messages, and is generally a poor choice of
strategy to implement a message handler.

When you click *what* scrollbar of what control?  If you have a scrollbar control, the
message is routed to the parent of the scrollbar, unless you have an ON_..._REFLECT or
ON_..._REFLECT_EX handler in your child control.  And only some messages are reflected.
					joe

On Thu, 27 Mar 2008 06:43:00 -0700, Kjell Arne Johansen
<KjellArneJohansen@discussions.microsoft.com> wrote:

>Thank you for responding to my request Mr. Newcomer.
>Yes I know there is a lack of details.
>I did not want to bother people with too many details if it was possible 
>from a short overview to give me some general information on where to look.  
>Some obvious things about windows message handling that I should look into.
>
>The code in question is really old and has been living in our system for 
>many years and working fine.
>
>Due to the architecture of this particular part of the code PreTranslate has 
>been overridden.  The specific message is checked for in PreTranslate.
>
>I hoped that my information about that this problem only occurs when I click 
>the scrollbar should be enough information.  E.g �if you click the scrollbar 
>then your message will be routed to the scrollbar and you have to��.
>
>I will prepare a more detailed description and come back later with ha new 
>question.
>
>Regards Kjell Arne Johansen 
>sw engineer.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
3/27/2008 2:13:05 PM
Thank you for your time.

Regards Kjell Arne Johansen

"Joseph M. Newcomer" wrote:

> PreTranslateMessage does not apply to all messages, and is generally a poor choice of
> strategy to implement a message handler.
> 
> When you click *what* scrollbar of what control?  If you have a scrollbar control, the
> message is routed to the parent of the scrollbar, unless you have an ON_..._REFLECT or
> ON_..._REFLECT_EX handler in your child control.  And only some messages are reflected.
> 					joe
> 
> On Thu, 27 Mar 2008 06:43:00 -0700, Kjell Arne Johansen
> <KjellArneJohansen@discussions.microsoft.com> wrote:
> 
> >Thank you for responding to my request Mr. Newcomer.
> >Yes I know there is a lack of details.
> >I did not want to bother people with too many details if it was possible 
> >from a short overview to give me some general information on where to look.  
> >Some obvious things about windows message handling that I should look into.
> >
> >The code in question is really old and has been living in our system for 
> >many years and working fine.
> >
> >Due to the architecture of this particular part of the code PreTranslate has 
> >been overridden.  The specific message is checked for in PreTranslate.
> >
> >I hoped that my information about that this problem only occurs when I click 
> >the scrollbar should be enough information.  E.g “if you click the scrollbar 
> >then your message will be routed to the scrollbar and you have to…”.
> >
> >I will prepare a more detailed description and come back later with ha new 
> >question.
> >
> >Regards Kjell Arne Johansen 
> >sw engineer.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> 
0
3/27/2008 2:25:01 PM
Hi

I have changed the code, not using PreTranslate now.  It's working fine.
I wish I knew why it did not work...

Thank you

Regards Kjell Arne


"Joseph M. Newcomer" wrote:

> PreTranslateMessage does not apply to all messages, and is generally a poor choice of
> strategy to implement a message handler.
> 
> When you click *what* scrollbar of what control?  If you have a scrollbar control, the
> message is routed to the parent of the scrollbar, unless you have an ON_..._REFLECT or
> ON_..._REFLECT_EX handler in your child control.  And only some messages are reflected.
> 					joe
> 
> On Thu, 27 Mar 2008 06:43:00 -0700, Kjell Arne Johansen
> <KjellArneJohansen@discussions.microsoft.com> wrote:
> 
> >Thank you for responding to my request Mr. Newcomer.
> >Yes I know there is a lack of details.
> >I did not want to bother people with too many details if it was possible 
> >from a short overview to give me some general information on where to look.  
> >Some obvious things about windows message handling that I should look into.
> >
> >The code in question is really old and has been living in our system for 
> >many years and working fine.
> >
> >Due to the architecture of this particular part of the code PreTranslate has 
> >been overridden.  The specific message is checked for in PreTranslate.
> >
> >I hoped that my information about that this problem only occurs when I click 
> >the scrollbar should be enough information.  E.g “if you click the scrollbar 
> >then your message will be routed to the scrollbar and you have to…”.
> >
> >I will prepare a more detailed description and come back later with ha new 
> >question.
> >
> >Regards Kjell Arne Johansen 
> >sw engineer.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> 
0
4/23/2008 11:39:00 AM
Reply:

Similar Artilces:

Message tracking center #2
Exchange System installed on an XP Workstation. When I run a search, the following message is displayed : Could not find the specified exported object Installation : Win32 Error ID : 80070776 Exchange System Manager ...

How to raise custom Validation Message in PropertyGrid?
Currently I'm using "PropertyGrid" control for my C# application. My problem is that when I input some "alphabetic" values(e.g. abc) for a property which only accpets “Integer” values, I get the error message below - "Property value is not valid", in the details panel, the information is like this - " 'abc' is not a valid value for Int32". Could I customize this error message?(e.g. showing some user-friendly message instead of "Int32"). ...

Corrupted message
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Power PC Email Client: pop I keep getting a message when I backup my database that there was a problem backing up one of my email messages. The suggestion is to run the database utility, which I do but it doesn't keep the message from popping up again when I backup the next time. <br> Is there a way to pinpoint which message is the problem in the database? <br> Also, is there a way to scan the messages for viruses once they are in the database? <br> Thanks, <br> Wm On 3/5/10 12:42 PM, in ...

Messages sent only to me in blue setting not working
For some reason this setting no longer works after we moved to new PCs at our company. Strange because it works for some memebers of our group and not others. Any suggestions would be appreciated. We have absolutely no idea what you are talking about: Please provide: Version of Office/Outlook Where this "mail sent to me" setting? Is this done via a rule? Have you checked your settings against those of people where it does work? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all...

Sending message to a DLL
Hello group, Is it possible to send windows messages to and from a Dll? I have a MFC DLL derived from CWinApp, and it does have a "Begin...End Message Map"; but since it is 'windowless' how do I use SendMessage, considering the first parameter is a 'hWnd' of the window you want to send the message to? TIA, Ray K. You can send some messages to a CWinApp object. You can also send some to the CDocument type object. It's built into the framework. Tom "raykos" <raykos@discussions.microsoft.com> wrote in message news:D8980704-9FD7-4...

Open previous email message
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Email Client: pop Is there a way to configure Entourage to open the previous [or next] email message upon delete like there is in Outlook? It's really slow to have to move to the next message after deleting a new message rather than have it default to it. Thank you, Mike On 2/10/10 1:34 PM, thustra@officeformac.com wrote: > Is there a way to configure Entourage to open the previous [or next] > email message upon delete like there is in Outlook? It's really slow > to have to move to the next message afte...

CWnd::Attach or CWnd::SubclassWindow???
Hi guys, I'm trying to capture WM_SHOWWINDOW (for an example notepad.exe) from another CWnd object. I also want the CWnd object to be deleted away when the targeted CWnd destroys. Apart from using hook, can I achieve it by using CWnd::Attach or CWnd::SubclassWindow? If that's so, which one is a better approach? Thanks in advance. ...

Embedded Link error message
When I click on an embedded link in an e-mail message in Outlook 2003 I receive the following message. "This operation has been cancelled due to restrictions on this computer. Please contact your system adminstrator." Since I am the only user of this computer I am the adminstrator. The operating system is Windows XP home edition. I need to know how to get rid of this message and allow the link to work correctly. ...

error in receiving messages.
I started getting an error message last night when I tryed to set my emails, and am still getting the same message this morning. The message is as follows The connection to the server has failed. Account: 'mail.charter.net', Server: 'mail.charter.net', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E What so I need to do. Thanks, Bill "bransn1" <bransn1@discussions.microsoft.com> wrote in message news:774E5DA8-C0DB-4354-8C35-A8482F1876EA@microsoft.com... >I started getting an error message last n...

when requesting a meeting need to CC the message to others
Requesting a meeting and need to CC the message to the secretary of the person being requested to attend the meeting. We get a send options error when doing this help ...

Copy Inbound Messages Based on Content
Hello All, We are in the planning stages of an Exchange 2003 deployment for a client. They have a request/requirement that messages containing designated content/keywords in the Subject or Body be copied to another mailbox. As far as I know this cannot be done natively in Exchange, or can it?? Is there anyone who can point me to a potential 3rd party vendor that would offer this functionality? Can something like this be done at all? :-) Thank you in advance for your opinions and advice Paul You may be able to use your A/V - SPAM program to feret out and fwd what you are looking for...

OE unsafe file attachement message
Each time I send an e-mail with an attachment there is a message stating the following: "OE removed access to the following unsafe file attachments". I was able to discover this by looking in my sent items folder and pulling up each individual e-mail. However, I did a test and sent to some people they did receive the e-mail and attachments. Any idea what this is all about. Thanks in advance! This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite different program, despite its similar name.. You will...

Where Do Messages Go??
If there isn't a kink in my program and it's behaving as it should, I hope someone can answer my questions. Messages disappear. Example: I e-mailed a friend, who e-mailed me back. When I answered that response, I could find no trace of it in "sent mail" or anywhere else, and the item in my inbox maintained its appearance as unread mail. If I click "mark read" it disappears altogether. I've lost several messages this way. Also I seem to be unable to drag a message from one folder to another. It gets lost in the transporter, never to be seen agai...

Messages Sticking in My Own Server Queue
Exchange 2003 Server Enterprise. Windows 2003 Server R2. I am getting some outgoing messages that originated from my domain (my server) and that are going to folks in the domain and are getting "stuck" in our domain's queue. For example, A message sent from bob.jones@goodnewsjail.org and going to john.doe@goodnewsjail.org remains sitting in queue "mail.goodnewsjail.org." This is only happening for emails sent from a couple people in our domain, and not all their emails are sticking. A "Force Connection" from the Exchange System manager does no good....

how to let a dialog can receive the WM_PARENTNOTIFY message
my app have a main dlg,and the main dlg will create some child dlgs.I want the main dlg can receive a message when a child dlg is created or destroyed,but dlg can not receive the WM_PARENTNOTIFY message,so how can I do? You could use ON_MESSAGE or the RegisterWindowMessage Varient, have a look in MSDN, then use SendMessage from the Child Window, or alternatively use a static callback function. Take your pick. M "pango" <pango@discussions.microsoft.com> wrote in message news:ED6115BF-629E-4FF1-8C4F-0D3568ED122A@microsoft.com... > my app have a main dlg,and the main d...

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...

Where do the Archives Go?
I cannot find the information Outlook claims to have archived for me. Yes I know how to display the archived calendar, but it's blank. Any ideas? Thanks! I use XP, and Office 2007. "6Sigma 5s No Clue" <6Sigma5sNoClue@discussions.microsoft.com> wrote in message news:B239B721-DCF1-4337-947D-B325D4BF0E4A@microsoft.com... >I cannot find the information Outlook claims to have archived for me. Yes I > know how to display the archived calendar, but it's blank. Any ideas? > Thanks! > > I use XP, and Office 2007. Why do you think Outook is arch...

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...

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 ...

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 ---------------------------------...

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. ...

Unable to go offline / Sales for Outlook Error
Hi all, When I try to go offline I started to get the below message. "Due to a high volume of server activity, Microsoft CRM Sales for Outlook is unable to successfully take some items offline at this time" With same volume of server activity (which is not so high) I was able to go offline before but now I can't figure out why it gives this error. Can anyone help me to resolve this? Any idea/help would be appreciated. Thanks, Didem ...

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...