Receiving windows message after mainframe is destroyed

Hi I am posting this again - not having heard anything in several days.
Please let me know if there is another group I shoudl post this to.

------
I am stuck and could use any suggestion.

My application (MSVC 6 & MFC) uses a mainframe that is hidden soon after it
is created & uses a tray icon for user interactions. I have had no problem
for quite some time - till I upgraded from WinXP home - SP1 to WinXP rpo
XP2.  The application crashes on exit in the debug mode.  The error is an
ASSERT in CWnd::WalkPretranslateTree. This function is checking if any
windows wants to translate the message and the last window being checked is
my mainframe which has been destroyed by now (the problem occurs after
OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.

The message itself is a registered window message. My application registers
many Windows messages and this message is NOT in the range of the messages
that
my application registers - and it is not one that my application
registers (are there messages that is registered on behalf of my application
that I do no know about?).

Is there anything I can do to check/clear all the messages in the queue
before I call CFrameWnd::OnNcDestroy?

This problem does not occur in my other XP machine which is yet to be
upgraded to SP2.

How can I track this problem?  How can I find out where this registered
message is coming from?  I am not familiar with SPY++ - perhaps someone can
tell me how I can use it or some other tool to track the source of this
message & see where my problem is?



0
rajas (56)
12/17/2004 5:32:03 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
851 Views

Similar Articles

[PageSpeed] 23

rajas,

Little do I know of your problem, but as you're not getting much help, I'll
have to do.

First of all, you don't want to try to purge the message queue, and you are
*not* interested in where the message came from :-) As long as you have made
sure that it is not sent from your own code, you can do very little about
it.

You'll rather have to find a way to close the application without getting
this error - and that would of course be to delay the destruction still a
little while, or make sure that it is destroyed in a proper way.

The way I would approach this would be to create an application with the
same structure (that is, the same type of frame/view etc), and then
thoroughly trace the close down operations of this app, making sure that
your application follows the same method. You might also want to experiment
with not hiding the main window, to see if this has any impact.

It might not be a realistic option for you, but in case it is, I would
consider rewriting the application using a simpler superstructure if you are
hiding it anyway (such as using a simple dialog for the main window).

To summarize, you have the wrong approach if you try to wrestle Windows/MFC
to work your way, rather than adapt. Adapt or die :-)

Johan Rosengren
Abstrakt Mekanik AB

"rajas" <rajas@cox.net> a �crit dans le message de
news:kKEwd.2$iD.0@fed1read05...
> Hi I am posting this again - not having heard anything in several days.
> Please let me know if there is another group I shoudl post this to.
>
> ------
> I am stuck and could use any suggestion.
>
> My application (MSVC 6 & MFC) uses a mainframe that is hidden soon after
it
> is created & uses a tray icon for user interactions. I have had no problem
> for quite some time - till I upgraded from WinXP home - SP1 to WinXP rpo
> XP2.  The application crashes on exit in the debug mode.  The error is an
> ASSERT in CWnd::WalkPretranslateTree. This function is checking if any
> windows wants to translate the message and the last window being checked
is
> my mainframe which has been destroyed by now (the problem occurs after
> OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
>
> The message itself is a registered window message. My application
registers
> many Windows messages and this message is NOT in the range of the messages
> that
> my application registers - and it is not one that my application
> registers (are there messages that is registered on behalf of my
application
> that I do no know about?).
>
> Is there anything I can do to check/clear all the messages in the queue
> before I call CFrameWnd::OnNcDestroy?
>
> This problem does not occur in my other XP machine which is yet to be
> upgraded to SP2.
>
> How can I track this problem?  How can I find out where this registered
> message is coming from?  I am not familiar with SPY++ - perhaps someone
can
> tell me how I can use it or some other tool to track the source of this
> message & see where my problem is?
>
>
>


0
12/18/2004 8:56:29 AM
Thanks Johan for responding.  Sometimes all it takes is for another person
to chime in in order to find the problem.

My problem is that this is a fairly large and complex application that
compiles and runs without problems in my old computer (Win XP home SP1 ,
MSVC6 with all the updates). In my new computer (Win XP Professional SP2,
MSVC6 with all updates), I get an error during debug becuase a message is
sent to a window that is closed).

I read somewhere that SP2 has made changes that can expose bugs - especially
those associated with improper cleanup (may be just a rumour started to get
people to spend hours with their code).

I have walked through the closing step by step & my Window is closed -
properly.   What I guess is that some system service (could it be COM?) is
remembering the HWND of the main window and this message is sent.  If I can
find the message, I can guess what is happening.  But the message is in the
range of those in the RegisteredWindowsMessage - but before any of my
messages  (all of mine are in sequence).  Perhaps there is a list of such
messages somewhere.   For instance, I use the Registered Windows Message
WM_TASKBARCREATED which turns out to be C090 according to my TRACE.   The
offending message is C12E and the crash is in the MFC function
WalkPreTranslateTree.   My messages start with C170

-rajas

"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:%23n$%23x%23N5EHA.3840@tk2msftngp13.phx.gbl...
> rajas,
>
> Little do I know of your problem, but as you're not getting much help,
I'll
> have to do.
>
> First of all, you don't want to try to purge the message queue, and you
are
> *not* interested in where the message came from :-) As long as you have
made
> sure that it is not sent from your own code, you can do very little about
> it.
>
> You'll rather have to find a way to close the application without getting
> this error - and that would of course be to delay the destruction still a
> little while, or make sure that it is destroyed in a proper way.
>
> The way I would approach this would be to create an application with the
> same structure (that is, the same type of frame/view etc), and then
> thoroughly trace the close down operations of this app, making sure that
> your application follows the same method. You might also want to
experiment
> with not hiding the main window, to see if this has any impact.
>
> It might not be a realistic option for you, but in case it is, I would
> consider rewriting the application using a simpler superstructure if you
are
> hiding it anyway (such as using a simple dialog for the main window).
>
> To summarize, you have the wrong approach if you try to wrestle
Windows/MFC
> to work your way, rather than adapt. Adapt or die :-)
>
> Johan Rosengren
> Abstrakt Mekanik AB
>
> "rajas" <rajas@cox.net> a �crit dans le message de
> news:kKEwd.2$iD.0@fed1read05...
> > Hi I am posting this again - not having heard anything in several days.
> > Please let me know if there is another group I shoudl post this to.
> >
> > ------
> > I am stuck and could use any suggestion.
> >
> > My application (MSVC 6 & MFC) uses a mainframe that is hidden soon after
> it
> > is created & uses a tray icon for user interactions. I have had no
problem
> > for quite some time - till I upgraded from WinXP home - SP1 to WinXP rpo
> > XP2.  The application crashes on exit in the debug mode.  The error is
an
> > ASSERT in CWnd::WalkPretranslateTree. This function is checking if any
> > windows wants to translate the message and the last window being checked
> is
> > my mainframe which has been destroyed by now (the problem occurs after
> > OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
> >
> > The message itself is a registered window message. My application
> registers
> > many Windows messages and this message is NOT in the range of the
messages
> > that
> > my application registers - and it is not one that my application
> > registers (are there messages that is registered on behalf of my
> application
> > that I do no know about?).
> >
> > Is there anything I can do to check/clear all the messages in the queue
> > before I call CFrameWnd::OnNcDestroy?
> >
> > This problem does not occur in my other XP machine which is yet to be
> > upgraded to SP2.
> >
> > How can I track this problem?  How can I find out where this registered
> > message is coming from?  I am not familiar with SPY++ - perhaps someone
> can
> > tell me how I can use it or some other tool to track the source of this
> > message & see where my problem is?
> >
> >
> >
>
>


0
rajas (56)
12/18/2004 8:36:49 PM
Are you using any ON_MESSAGE handlers?

Make sure the functions have exact prorotype:

LRESULT memberFxn( WPARAM, LPARAM );

Parameters are critical. If you pass a handler without parameters, you will 
observe very mysterios crashes, because of stack corruption.

Visual C 7 takes care of it (it will flag those functions), but not VC 6.

"rajas" <rajas@cox.net> wrote in message news:wx0xd.118$iD.111@fed1read05...
> Thanks Johan for responding.  Sometimes all it takes is for another person
> to chime in in order to find the problem.
>
> My problem is that this is a fairly large and complex application that
> compiles and runs without problems in my old computer (Win XP home SP1 ,
> MSVC6 with all the updates). In my new computer (Win XP Professional SP2,
> MSVC6 with all updates), I get an error during debug becuase a message is
> sent to a window that is closed).
>
> I read somewhere that SP2 has made changes that can expose bugs - 
> especially
> those associated with improper cleanup (may be just a rumour started to 
> get
> people to spend hours with their code).
>
> I have walked through the closing step by step & my Window is closed -
> properly.   What I guess is that some system service (could it be COM?) is
> remembering the HWND of the main window and this message is sent.  If I 
> can
> find the message, I can guess what is happening.  But the message is in 
> the
> range of those in the RegisteredWindowsMessage - but before any of my
> messages  (all of mine are in sequence).  Perhaps there is a list of such
> messages somewhere.   For instance, I use the Registered Windows Message
> WM_TASKBARCREATED which turns out to be C090 according to my TRACE.   The
> offending message is C12E and the crash is in the MFC function
> WalkPreTranslateTree.   My messages start with C170
>
> -rajas
>
> "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> news:%23n$%23x%23N5EHA.3840@tk2msftngp13.phx.gbl...
>> rajas,
>>
>> Little do I know of your problem, but as you're not getting much help,
> I'll
>> have to do.
>>
>> First of all, you don't want to try to purge the message queue, and you
> are
>> *not* interested in where the message came from :-) As long as you have
> made
>> sure that it is not sent from your own code, you can do very little about
>> it.
>>
>> You'll rather have to find a way to close the application without getting
>> this error - and that would of course be to delay the destruction still a
>> little while, or make sure that it is destroyed in a proper way.
>>
>> The way I would approach this would be to create an application with the
>> same structure (that is, the same type of frame/view etc), and then
>> thoroughly trace the close down operations of this app, making sure that
>> your application follows the same method. You might also want to
> experiment
>> with not hiding the main window, to see if this has any impact.
>>
>> It might not be a realistic option for you, but in case it is, I would
>> consider rewriting the application using a simpler superstructure if you
> are
>> hiding it anyway (such as using a simple dialog for the main window).
>>
>> To summarize, you have the wrong approach if you try to wrestle
> Windows/MFC
>> to work your way, rather than adapt. Adapt or die :-)
>>
>> Johan Rosengren
>> Abstrakt Mekanik AB
>>
>> "rajas" <rajas@cox.net> a �crit dans le message de
>> news:kKEwd.2$iD.0@fed1read05...
>> > Hi I am posting this again - not having heard anything in several days.
>> > Please let me know if there is another group I shoudl post this to.
>> >
>> > ------
>> > I am stuck and could use any suggestion.
>> >
>> > My application (MSVC 6 & MFC) uses a mainframe that is hidden soon 
>> > after
>> it
>> > is created & uses a tray icon for user interactions. I have had no
> problem
>> > for quite some time - till I upgraded from WinXP home - SP1 to WinXP 
>> > rpo
>> > XP2.  The application crashes on exit in the debug mode.  The error is
> an
>> > ASSERT in CWnd::WalkPretranslateTree. This function is checking if any
>> > windows wants to translate the message and the last window being 
>> > checked
>> is
>> > my mainframe which has been destroyed by now (the problem occurs after
>> > OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
>> >
>> > The message itself is a registered window message. My application
>> registers
>> > many Windows messages and this message is NOT in the range of the
> messages
>> > that
>> > my application registers - and it is not one that my application
>> > registers (are there messages that is registered on behalf of my
>> application
>> > that I do no know about?).
>> >
>> > Is there anything I can do to check/clear all the messages in the queue
>> > before I call CFrameWnd::OnNcDestroy?
>> >
>> > This problem does not occur in my other XP machine which is yet to be
>> > upgraded to SP2.
>> >
>> > How can I track this problem?  How can I find out where this registered
>> > message is coming from?  I am not familiar with SPY++ - perhaps someone
>> can
>> > tell me how I can use it or some other tool to track the source of this
>> > message & see where my problem is?
>> >
>> >
>> >
>>
>>
>
> 


0
alegr (1131)
12/18/2004 9:04:38 PM
Yes,

I do use On_MESSAGE handlers & all the prototypes are of the form "LRESULT
memberFxn( WPARAM, LPARAM );"  Of course for the Registered Window Messages
I use ON_REGISTERED_MESSAGE & in one instance I use ON_MESSAGE_VOID which
does not have parameters.  None of these message handlers are for the Window
in question which is the Main Window of my application.



"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:eXLDxUU5EHA.128@TK2MSFTNGP15.phx.gbl...
> Are you using any ON_MESSAGE handlers?
>
> Make sure the functions have exact prorotype:
>
> LRESULT memberFxn( WPARAM, LPARAM );
>
> Parameters are critical. If you pass a handler without parameters, you
will
> observe very mysterios crashes, because of stack corruption.
>
> Visual C 7 takes care of it (it will flag those functions), but not VC 6.
>
> "rajas" <rajas@cox.net> wrote in message
news:wx0xd.118$iD.111@fed1read05...
> > Thanks Johan for responding.  Sometimes all it takes is for another
person
> > to chime in in order to find the problem.
> >
> > My problem is that this is a fairly large and complex application that
> > compiles and runs without problems in my old computer (Win XP home SP1 ,
> > MSVC6 with all the updates). In my new computer (Win XP Professional
SP2,
> > MSVC6 with all updates), I get an error during debug becuase a message
is
> > sent to a window that is closed).
> >
> > I read somewhere that SP2 has made changes that can expose bugs -
> > especially
> > those associated with improper cleanup (may be just a rumour started to
> > get
> > people to spend hours with their code).
> >
> > I have walked through the closing step by step & my Window is closed -
> > properly.   What I guess is that some system service (could it be COM?)
is
> > remembering the HWND of the main window and this message is sent.  If I
> > can
> > find the message, I can guess what is happening.  But the message is in
> > the
> > range of those in the RegisteredWindowsMessage - but before any of my
> > messages  (all of mine are in sequence).  Perhaps there is a list of
such
> > messages somewhere.   For instance, I use the Registered Windows Message
> > WM_TASKBARCREATED which turns out to be C090 according to my TRACE.
The
> > offending message is C12E and the crash is in the MFC function
> > WalkPreTranslateTree.   My messages start with C170
> >
> > -rajas
> >
> > "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> > news:%23n$%23x%23N5EHA.3840@tk2msftngp13.phx.gbl...
> >> rajas,
> >>
> >> Little do I know of your problem, but as you're not getting much help,
> > I'll
> >> have to do.
> >>
> >> First of all, you don't want to try to purge the message queue, and you
> > are
> >> *not* interested in where the message came from :-) As long as you have
> > made
> >> sure that it is not sent from your own code, you can do very little
about
> >> it.
> >>
> >> You'll rather have to find a way to close the application without
getting
> >> this error - and that would of course be to delay the destruction still
a
> >> little while, or make sure that it is destroyed in a proper way.
> >>
> >> The way I would approach this would be to create an application with
the
> >> same structure (that is, the same type of frame/view etc), and then
> >> thoroughly trace the close down operations of this app, making sure
that
> >> your application follows the same method. You might also want to
> > experiment
> >> with not hiding the main window, to see if this has any impact.
> >>
> >> It might not be a realistic option for you, but in case it is, I would
> >> consider rewriting the application using a simpler superstructure if
you
> > are
> >> hiding it anyway (such as using a simple dialog for the main window).
> >>
> >> To summarize, you have the wrong approach if you try to wrestle
> > Windows/MFC
> >> to work your way, rather than adapt. Adapt or die :-)
> >>
> >> Johan Rosengren
> >> Abstrakt Mekanik AB
> >>
> >> "rajas" <rajas@cox.net> a �crit dans le message de
> >> news:kKEwd.2$iD.0@fed1read05...
> >> > Hi I am posting this again - not having heard anything in several
days.
> >> > Please let me know if there is another group I shoudl post this to.
> >> >
> >> > ------
> >> > I am stuck and could use any suggestion.
> >> >
> >> > My application (MSVC 6 & MFC) uses a mainframe that is hidden soon
> >> > after
> >> it
> >> > is created & uses a tray icon for user interactions. I have had no
> > problem
> >> > for quite some time - till I upgraded from WinXP home - SP1 to WinXP
> >> > rpo
> >> > XP2.  The application crashes on exit in the debug mode.  The error
is
> > an
> >> > ASSERT in CWnd::WalkPretranslateTree. This function is checking if
any
> >> > windows wants to translate the message and the last window being
> >> > checked
> >> is
> >> > my mainframe which has been destroyed by now (the problem occurs
after
> >> > OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
> >> >
> >> > The message itself is a registered window message. My application
> >> registers
> >> > many Windows messages and this message is NOT in the range of the
> > messages
> >> > that
> >> > my application registers - and it is not one that my application
> >> > registers (are there messages that is registered on behalf of my
> >> application
> >> > that I do no know about?).
> >> >
> >> > Is there anything I can do to check/clear all the messages in the
queue
> >> > before I call CFrameWnd::OnNcDestroy?
> >> >
> >> > This problem does not occur in my other XP machine which is yet to be
> >> > upgraded to SP2.
> >> >
> >> > How can I track this problem?  How can I find out where this
registered
> >> > message is coming from?  I am not familiar with SPY++ - perhaps
someone
> >> can
> >> > tell me how I can use it or some other tool to track the source of
this
> >> > message & see where my problem is?
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>


0
rajas (56)
12/19/2004 4:54:52 AM
How your ON_REGISTERED_MESSAGE handler looks?

If you have an opportunity, feed your program to VC 2002 or 2003. It will 
flag any wrong handler functions.

"rajas" <rajas@cox.net> wrote in message news:pQ7xd.575$iD.222@fed1read05...
> Yes,
>
> I do use On_MESSAGE handlers & all the prototypes are of the form "LRESULT
> memberFxn( WPARAM, LPARAM );"  Of course for the Registered Window 
> Messages
> I use ON_REGISTERED_MESSAGE & in one instance I use ON_MESSAGE_VOID which
> does not have parameters.  None of these message handlers are for the 
> Window
> in question which is the Main Window of my application.
>
>
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:eXLDxUU5EHA.128@TK2MSFTNGP15.phx.gbl...
>> Are you using any ON_MESSAGE handlers?
>>
>> Make sure the functions have exact prorotype:
>>
>> LRESULT memberFxn( WPARAM, LPARAM );
>>
>> Parameters are critical. If you pass a handler without parameters, you
> will
>> observe very mysterios crashes, because of stack corruption.
>>
>> Visual C 7 takes care of it (it will flag those functions), but not VC 6.
>>
>> "rajas" <rajas@cox.net> wrote in message
> news:wx0xd.118$iD.111@fed1read05...
>> > Thanks Johan for responding.  Sometimes all it takes is for another
> person
>> > to chime in in order to find the problem.
>> >
>> > My problem is that this is a fairly large and complex application that
>> > compiles and runs without problems in my old computer (Win XP home SP1 
>> > ,
>> > MSVC6 with all the updates). In my new computer (Win XP Professional
> SP2,
>> > MSVC6 with all updates), I get an error during debug becuase a message
> is
>> > sent to a window that is closed).
>> >
>> > I read somewhere that SP2 has made changes that can expose bugs -
>> > especially
>> > those associated with improper cleanup (may be just a rumour started to
>> > get
>> > people to spend hours with their code).
>> >
>> > I have walked through the closing step by step & my Window is closed -
>> > properly.   What I guess is that some system service (could it be COM?)
> is
>> > remembering the HWND of the main window and this message is sent.  If I
>> > can
>> > find the message, I can guess what is happening.  But the message is in
>> > the
>> > range of those in the RegisteredWindowsMessage - but before any of my
>> > messages  (all of mine are in sequence).  Perhaps there is a list of
> such
>> > messages somewhere.   For instance, I use the Registered Windows 
>> > Message
>> > WM_TASKBARCREATED which turns out to be C090 according to my TRACE.
> The
>> > offending message is C12E and the crash is in the MFC function
>> > WalkPreTranslateTree.   My messages start with C170
>> >
>> > -rajas
>> >
>> > "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
>> > news:%23n$%23x%23N5EHA.3840@tk2msftngp13.phx.gbl...
>> >> rajas,
>> >>
>> >> Little do I know of your problem, but as you're not getting much help,
>> > I'll
>> >> have to do.
>> >>
>> >> First of all, you don't want to try to purge the message queue, and 
>> >> you
>> > are
>> >> *not* interested in where the message came from :-) As long as you 
>> >> have
>> > made
>> >> sure that it is not sent from your own code, you can do very little
> about
>> >> it.
>> >>
>> >> You'll rather have to find a way to close the application without
> getting
>> >> this error - and that would of course be to delay the destruction 
>> >> still
> a
>> >> little while, or make sure that it is destroyed in a proper way.
>> >>
>> >> The way I would approach this would be to create an application with
> the
>> >> same structure (that is, the same type of frame/view etc), and then
>> >> thoroughly trace the close down operations of this app, making sure
> that
>> >> your application follows the same method. You might also want to
>> > experiment
>> >> with not hiding the main window, to see if this has any impact.
>> >>
>> >> It might not be a realistic option for you, but in case it is, I would
>> >> consider rewriting the application using a simpler superstructure if
> you
>> > are
>> >> hiding it anyway (such as using a simple dialog for the main window).
>> >>
>> >> To summarize, you have the wrong approach if you try to wrestle
>> > Windows/MFC
>> >> to work your way, rather than adapt. Adapt or die :-)
>> >>
>> >> Johan Rosengren
>> >> Abstrakt Mekanik AB
>> >>
>> >> "rajas" <rajas@cox.net> a �crit dans le message de
>> >> news:kKEwd.2$iD.0@fed1read05...
>> >> > Hi I am posting this again - not having heard anything in several
> days.
>> >> > Please let me know if there is another group I shoudl post this to.
>> >> >
>> >> > ------
>> >> > I am stuck and could use any suggestion.
>> >> >
>> >> > My application (MSVC 6 & MFC) uses a mainframe that is hidden soon
>> >> > after
>> >> it
>> >> > is created & uses a tray icon for user interactions. I have had no
>> > problem
>> >> > for quite some time - till I upgraded from WinXP home - SP1 to WinXP
>> >> > rpo
>> >> > XP2.  The application crashes on exit in the debug mode.  The error
> is
>> > an
>> >> > ASSERT in CWnd::WalkPretranslateTree. This function is checking if
> any
>> >> > windows wants to translate the message and the last window being
>> >> > checked
>> >> is
>> >> > my mainframe which has been destroyed by now (the problem occurs
> after
>> >> > OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
>> >> >
>> >> > The message itself is a registered window message. My application
>> >> registers
>> >> > many Windows messages and this message is NOT in the range of the
>> > messages
>> >> > that
>> >> > my application registers - and it is not one that my application
>> >> > registers (are there messages that is registered on behalf of my
>> >> application
>> >> > that I do no know about?).
>> >> >
>> >> > Is there anything I can do to check/clear all the messages in the
> queue
>> >> > before I call CFrameWnd::OnNcDestroy?
>> >> >
>> >> > This problem does not occur in my other XP machine which is yet to 
>> >> > be
>> >> > upgraded to SP2.
>> >> >
>> >> > How can I track this problem?  How can I find out where this
> registered
>> >> > message is coming from?  I am not familiar with SPY++ - perhaps
> someone
>> >> can
>> >> > tell me how I can use it or some other tool to track the source of
> this
>> >> > message & see where my problem is?
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
> 


0
alegr (1131)
12/19/2004 8:55:27 PM
I went through all of them - they all have the signature of the form
    afx_msg LRESULT memberFxn( WPARAM, LPARAM );
A couple of them cast the WPARAM to UINT while functioning, but the
signature is the same.  It should be noted that the message that is giving
me problems is not one that I egister for my applicataion.

Unfortunately, I do not have VC2002 0r VC2003.   I will be getting an MSDN
Universl subscription but it does not start till next Feb.

Is it possible to trace the message through SPY+ ? I do not know how to set
it up to trace Registered messages.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:uAWiU0g5EHA.1596@tk2msftngp13.phx.gbl...
> How your ON_REGISTERED_MESSAGE handler looks?
>
> If you have an opportunity, feed your program to VC 2002 or 2003. It will
> flag any wrong handler functions.
>
> "rajas" <rajas@cox.net> wrote in message
news:pQ7xd.575$iD.222@fed1read05...
> > Yes,
> >
> > I do use On_MESSAGE handlers & all the prototypes are of the form
"LRESULT
> > memberFxn( WPARAM, LPARAM );"  Of course for the Registered Window
> > Messages
> > I use ON_REGISTERED_MESSAGE & in one instance I use ON_MESSAGE_VOID
which
> > does not have parameters.  None of these message handlers are for the
> > Window
> > in question which is the Main Window of my application.
> >
> >
> >
> > "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> > news:eXLDxUU5EHA.128@TK2MSFTNGP15.phx.gbl...
> >> Are you using any ON_MESSAGE handlers?
> >>
> >> Make sure the functions have exact prorotype:
> >>
> >> LRESULT memberFxn( WPARAM, LPARAM );
> >>
> >> Parameters are critical. If you pass a handler without parameters, you
> > will
> >> observe very mysterios crashes, because of stack corruption.
> >>
> >> Visual C 7 takes care of it (it will flag those functions), but not VC
6.
> >>
> >> "rajas" <rajas@cox.net> wrote in message
> > news:wx0xd.118$iD.111@fed1read05...
> >> > Thanks Johan for responding.  Sometimes all it takes is for another
> > person
> >> > to chime in in order to find the problem.
> >> >
> >> > My problem is that this is a fairly large and complex application
that
> >> > compiles and runs without problems in my old computer (Win XP home
SP1
> >> > ,
> >> > MSVC6 with all the updates). In my new computer (Win XP Professional
> > SP2,
> >> > MSVC6 with all updates), I get an error during debug becuase a
message
> > is
> >> > sent to a window that is closed).
> >> >
> >> > I read somewhere that SP2 has made changes that can expose bugs -
> >> > especially
> >> > those associated with improper cleanup (may be just a rumour started
to
> >> > get
> >> > people to spend hours with their code).
> >> >
> >> > I have walked through the closing step by step & my Window is
closed -
> >> > properly.   What I guess is that some system service (could it be
COM?)
> > is
> >> > remembering the HWND of the main window and this message is sent.  If
I
> >> > can
> >> > find the message, I can guess what is happening.  But the message is
in
> >> > the
> >> > range of those in the RegisteredWindowsMessage - but before any of my
> >> > messages  (all of mine are in sequence).  Perhaps there is a list of
> > such
> >> > messages somewhere.   For instance, I use the Registered Windows
> >> > Message
> >> > WM_TASKBARCREATED which turns out to be C090 according to my TRACE.
> > The
> >> > offending message is C12E and the crash is in the MFC function
> >> > WalkPreTranslateTree.   My messages start with C170
> >> >
> >> > -rajas
> >> >
> >> > "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> >> > news:%23n$%23x%23N5EHA.3840@tk2msftngp13.phx.gbl...
> >> >> rajas,
> >> >>
> >> >> Little do I know of your problem, but as you're not getting much
help,
> >> > I'll
> >> >> have to do.
> >> >>
> >> >> First of all, you don't want to try to purge the message queue, and
> >> >> you
> >> > are
> >> >> *not* interested in where the message came from :-) As long as you
> >> >> have
> >> > made
> >> >> sure that it is not sent from your own code, you can do very little
> > about
> >> >> it.
> >> >>
> >> >> You'll rather have to find a way to close the application without
> > getting
> >> >> this error - and that would of course be to delay the destruction
> >> >> still
> > a
> >> >> little while, or make sure that it is destroyed in a proper way.
> >> >>
> >> >> The way I would approach this would be to create an application with
> > the
> >> >> same structure (that is, the same type of frame/view etc), and then
> >> >> thoroughly trace the close down operations of this app, making sure
> > that
> >> >> your application follows the same method. You might also want to
> >> > experiment
> >> >> with not hiding the main window, to see if this has any impact.
> >> >>
> >> >> It might not be a realistic option for you, but in case it is, I
would
> >> >> consider rewriting the application using a simpler superstructure if
> > you
> >> > are
> >> >> hiding it anyway (such as using a simple dialog for the main
window).
> >> >>
> >> >> To summarize, you have the wrong approach if you try to wrestle
> >> > Windows/MFC
> >> >> to work your way, rather than adapt. Adapt or die :-)
> >> >>
> >> >> Johan Rosengren
> >> >> Abstrakt Mekanik AB
> >> >>
> >> >> "rajas" <rajas@cox.net> a �crit dans le message de
> >> >> news:kKEwd.2$iD.0@fed1read05...
> >> >> > Hi I am posting this again - not having heard anything in several
> > days.
> >> >> > Please let me know if there is another group I shoudl post this
to.
> >> >> >
> >> >> > ------
> >> >> > I am stuck and could use any suggestion.
> >> >> >
> >> >> > My application (MSVC 6 & MFC) uses a mainframe that is hidden soon
> >> >> > after
> >> >> it
> >> >> > is created & uses a tray icon for user interactions. I have had no
> >> > problem
> >> >> > for quite some time - till I upgraded from WinXP home - SP1 to
WinXP
> >> >> > rpo
> >> >> > XP2.  The application crashes on exit in the debug mode.  The
error
> > is
> >> > an
> >> >> > ASSERT in CWnd::WalkPretranslateTree. This function is checking if
> > any
> >> >> > windows wants to translate the message and the last window being
> >> >> > checked
> >> >> is
> >> >> > my mainframe which has been destroyed by now (the problem occurs
> > after
> >> >> > OnNcDestroy in my CMainFrame which calls CFrameWnd::OnNcDestroy.
> >> >> >
> >> >> > The message itself is a registered window message. My application
> >> >> registers
> >> >> > many Windows messages and this message is NOT in the range of the
> >> > messages
> >> >> > that
> >> >> > my application registers - and it is not one that my application
> >> >> > registers (are there messages that is registered on behalf of my
> >> >> application
> >> >> > that I do no know about?).
> >> >> >
> >> >> > Is there anything I can do to check/clear all the messages in the
> > queue
> >> >> > before I call CFrameWnd::OnNcDestroy?
> >> >> >
> >> >> > This problem does not occur in my other XP machine which is yet to
> >> >> > be
> >> >> > upgraded to SP2.
> >> >> >
> >> >> > How can I track this problem?  How can I find out where this
> > registered
> >> >> > message is coming from?  I am not familiar with SPY++ - perhaps
> > someone
> >> >> can
> >> >> > tell me how I can use it or some other tool to track the source of
> > this
> >> >> > message & see where my problem is?
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>


0
rajas (56)
12/19/2004 9:34:18 PM
In Spy Messages options, there is Registered checkbox.

Check if your other message handlers have correct number of arguments. Any 
mismatch can cause a crash.

"rajas" <rajas@cox.net> wrote in message 
news:ptmxd.3377$iD.2481@fed1read05...
>I went through all of them - they all have the signature of the form
>    afx_msg LRESULT memberFxn( WPARAM, LPARAM );
> A couple of them cast the WPARAM to UINT while functioning, but the
> signature is the same.  It should be noted that the message that is giving
> me problems is not one that I egister for my applicataion.
>
> Unfortunately, I do not have VC2002 0r VC2003.   I will be getting an MSDN
> Universl subscription but it does not start till next Feb.
>
> Is it possible to trace the message through SPY+ ? I do not know how to 
> set
> it up to trace Registered messages.
>
>


0
alegr (1131)
12/19/2004 10:06:03 PM
Reply:

Similar Artilces:

windows update 04-15-10
I am running windows vista on a MAC computer with VMWare Fusion. I cannot get the service pack 1 or internet explorer 8 update to run. i get error code 490 and 800704090 Too late now! Support for Vista Gold (no Service Packs) ended on Tuesday, 13 April 2010! Computers running Vista Gold "will no longer receive software updates from Windows Update" until SP1 has been manually installed (which will require several Prerequisite Updates to be installed first). See http://windowsteamblog.com/blogs/windowsvista/archive/2010/04/13/end-of-support-for-windows-vista-with-no...

Install FrontPage 2003 on Windows 7
i tried several times to install, the program told me it has been installed, but it is not. What can I do. On Thu, 1 Apr 2010 10:48:01 -0700, monising <monising@discussions.microsoft.com> wrote: >i tried several times to install, the program told me it has been installed, >but it is not. What can I do. Please be more explicit about what you're doing, what you're seeing, and what error messages - if any - you are getting. I have FrontPage 2003 installed on Windows 7 Ultimate x64, and it's working fine. Also, are you installing from original media? A...

Junk button in windows live accidently pressed
Whenever I open up WLM i press sync automatically as a bad habbit. Because of the loading time, the junk button usually gets inserted before the sync button, pushing it out to the right after its loaded. I therefore accidently press the junk button by accident sometimes. This is a classic Microsoft HCI problem. Surely the button should be there but greyed out when you cant click it. Having buttons moving around in menus is bad in the same way popups are bad. So break your bad habit WLM will sync automatically when 1st opened peter -- If you find a posting or message...

Windows Live crap
About 4 days ago I noticed a site called Windows Live ID. It suggested to set up a profile and promised that with a single username and password you could log on to all Windows Live applications such as Hotmail, Windows Live Messenger, Windows Live Mail etc. etc. I thought what a good idea, not having to have 10 different usernames and passwords, so I used my old hotmail adress and username to set up a profile. But the ID said I coildn't use my hotmail for some reason, can't remember what. A few hours later I logged on to Windows Live Messenger as I have done for years, w...

Timestamp value of GINA window presentation
I am currently troubleshooting slow logon times for a client with computer infrastructure spread across the globe. Before I start invesagating I want to create a baseline for logon times. I have modified the clients logon script to record when it starts and when it ends. I am using the computers tick count to record how long the computer has been on, but realize that there is a space of time between the user authenicating to the computer (control-alt-delete) and when the logon script starts, if the customer turns his computer on and then leave for an extended period of time I ...

Deleting a half sent message
Sorry, forgot to say that I have Outlook 2003:) ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ...

Not receiving messages correctly
I have a Microsoft Outlook XP client that is used to get mail from an Exchange 5.5 server that is not receiving meesages in a timely manner. If I send a message to the mailbox it takes an average of 20 minutes to get delivered. Doing a manual send/receive does not help. The message only comes through when I change the message that I am viewing in the preview screen by cycling through the messages with the arrow keys. The message that is sent can be seen when logging into webmail though. Has anyone heard of this before? All of the service packs and latest updates are installed, and they have...

Send/Receive Problem
I am using Outlook 2002 on an XP platform. I cannot get Outlook to check for Email at regular intervals. I have the my Outlook set to Send and Receive all my accounts every 10 minutes but nothing happens. The only way I can receive Emails is by manually using the Send/Recv button or pressing F9. Can anyone offer any help. In case it is relevant I am using Norton Internet Security 2003. PWS Not sure it it Yor problem, but Outlook has some problems with Noroton Antivirus runing and chekking e-mails. As far as I know, Outlook may stop recieving e-mails from POP3 servers due to very le...

host unreachable after recent Windows Update
Exchange 5.5 on Windows 2000 Server, fully patched and running real swell until Wednesday morning. (Tuesday evening: applied the GDI+ patch: MS04-028.) Didn't find out until later today: internal e-mail is fine, inbound Internet e-mail is fine, but nothing goes out over the IMC. Each outbound e-mail generates Event ID 3010 warning message in the App log: host unreachable. But NSLOOKUP on that very server successfully resolve those same domain names, and ping gets replies. The only other software on this server: GroupShield 5.0 all up-to-date, and VirusScan 8.0.0 patch 1 push...

Issue installing FRx 6.7 on Windows 2003
I am encountering an unhandled exception error when attempting the installation. The installation prompts for the language, I select English, then Next. The progress bar makes it all the way to the right of the next screen, then I get the above error. This is a brand new quad CPU Dell OS is base WIndows Server 2003 Enterprise, not SP1 Only installed software is: IIS 6.0 (FTP, WWW, MSMQ) CA ArcServe (backup software) SQL 2000 Enterprise, Analysis Services, both at SP3a WinZip Acrobat 6.0 Reader Hello, Can you give us the exact error message you're receiving (all words and numbers fro...

Delay receiving email
Hi, We use Exchange 2000 and Windows 2000. I have recently been expeirencing intermitent delays in receiving email from two seperate domains.The delays are usually 3 hours but sometimes even longer. In the header info the delay happens at the last hop before reaching our domain. I have checked the exchange logs as well as the logs on our gateway but they do not indicate any delay once we receive the email. I am not sure what else I should do. Any help would be appreciated. Thanks, Bryan ...

Outlook 2003 not displaying multipart/mixed messages properly
This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C49BFC.AB34E1D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I know that Outlook is known for having problems displaying = multipart/mixed messages but this is just weird. I am using Outlook 2003 with a POP email account and occasionally with = an email that has been exchanged a few times already and I will send out = a reply and when the person replies back to me what they wrote no longer = appears in the email. I basically get back a copy of the email I sent =...

error message in Outlook after running windows and office updates
Hello, I am hoping someone can help me with this. When ever a few staff tries to send a new e-mail, a message "Do you want to save changes" come up and on the back of this message I see the spell checker box come up. The problem is that if you click on "no" on the error message, it comes up with another message something like "running out of memory". I just ran all the windows and office updates on all the machines in the company and so far two employees are having this problem. Is this something to do with the updates? Any suggestions? did you try ...

Outlook should keep files in the clipboard after closing a window
When you open a message (in a new window) in Outlook 2007, and copy one or more files contained in this message, and then close the window, the file is not kept in the clipboard. I have to copy the file and paste it before closing the window. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I ...

How to insert a URL with spaces into message body
Is it possible to insert a URL containing a space into a message body from a mailto hyperlink without using brackets? For example: <a href="mailto:jackblack@microsoft.com? body=<http://www.micro% 20soft.com>">jackblack@microsoft.com</a> This link will insert the URL '<http://www.micro soft.com>' (with a space between the 'o' and the 's') into the message body. However, the brackets will be visable too. If I remove the brackets, only the 'http://www.micro' portion will be hyperlinked. The 'soft.com' portion wi...

Bizarre background window behavior in Word
I am running MS Office for Mac 2008 (12.2.4) on a 2008 Intel iMac with the most recent version of Leopard OS. Since installing a recent upgrade to Mac Office 2008, I have been having a frustrating problem when I keep multiple documents open in Word. The active document will randomly be moved to the background, while one of the inactive open documents will randomly move to the foreground. Curiously, the inactive window now in the foreground actually remains inactive, and if I continue typing, the text is placed in the active window that is now hidden in the background. The only way to b...

E2K3
Our company is preparing for E2K3, one of the new policies we wanted to enforce was Prohibit Send and Receive limits. We did not enforce this in Ex5.5, but now we want to. Planned E2K3 limits would be 90MB-Warning, 100MB - Prohibit Send and 300MB - Prohibit Send and Receive. In our initial testing, it appears as though the Prohibit Send and Receive limit is not checked or enforced until the MAINTENANCE INTERVAL (MI)is run. We have this (MI) set to run at 1am-5am, so it looks like a user could continue to receive mail, say up to 900MB+ prior to the MI run, and after it runs, mail would ...

Can't delet Inbox messages.
I can not delete anything in my inbox. I can send email and view my email but when I highlite the message I can not delete...not even with the keyboard delete key. Any ideas would be appreciated. Thanks. More info, please - version and SP level of Outlook? Size of PST file? Ken wrote: > I can not delete anything in my inbox. I can send email > and view my email but when I highlite the message I can > not delete...not even with the keyboard delete key. Any > ideas would be appreciated. Thanks. ...

Message box when DOB meets certain criteria
Hi all, I am a relative novice to the ways of Access, I am currently setting up a database in Access 2003. I have a form field (DOB) that if the date of birth entered makes the person between 2 and 16 years old I would like a message box to appear notifying the user (and be able to turn it off). Similarly if an existing record is opened and a child has it's second birthday I would also like the message to appear.. .I have posted a similar request and have got thus far: Private Sub DOB_BeforeUpdate(Cancel As Integer) If DateAdd("yyyy", 2, [DOB]) > Date Or Date...

The message just sits in the Outbox.
I've setup a shortcut that point to command: mailto: What this does is bring up the Send Message window, where I just type the text, pick the sender and the message is supposedly sent. However, there is one problem: the message is actually not sent, but just sits in the Outbox folder. How can I force the message to be actually sent? (Without having Outlook open all the time). Thanks Do you have Outlook setup to send e-mail immediately when sent? "Frank Rizzo" <none@none.com> wrote in message news:%23r2qOQA7GHA.4116@TK2MSFTNGP03.phx.gbl... > I've setup a...

Disappearing messages
I have recently set up a new Exchange 2003 server at an organization I work for. I configured my mailbox on it, and copied over a large number of mail items from Personal Folders to my mailbox on the Exchange server with no problem. Then, I configured my boss's account. I copied over his last month or so worth of emails from his Personal Folders to his his Mailbox. (From April 9 through May 3). Now, he can only see messages from May 1 until today. I think this might be the result of a problem I had with the offline folder file (connection hung up and wouldn't synchronize, ...

Problem sending message into outlook
I need to send a message into Outlook from a third party program that automatically sets up the subject line and inserts text into the body of the message. I'm using Delphi's ShellExecute command which just sends a message to Windows and lets Windows handle it. However, when I do this, it removes my signature text which I need and just puts the new text in instead. I tried telling the message window to add my signature, but that option is grayed out. Does anyone know how I can get both the new text and the signature in without having to load the signature into my program or ...

Where can I find a Windows 7 newsgroup?
Sorry to post this here, but when I search the news.eternal-september.org for '7' (no quotes) I don't find anything. Nor when I search for "windows" TIA LAS alt.windows7.general Make sure you signed up with Eternal September correctly, or you will only see a small percentage of the available newsgroups. Also, right click on the newsgroup list and Reset it. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "LAS" <FakeMail@Hotmail.com> wrote in message news:i3fttq$7vd$1@news.eternal-september.org....

Error message
I cannot create a new folder on an external HDD. Win XP Pro, SP3. I go to My Computer, and select the external HDD letter. Then go over to the right-hand pane, right click and select New, then Folder. This produces an error message "Unable to create the folder 'New Folder' The file or directory is corrupted and unreadable." I can save and retrieve a Word document all right to this same external HDD. I can use the above method to create a new folder on the desktop, and on the two HDDs that are internal to the computer. Virus and malware scans are negati...

Complex Time Window / date based calculation
Excel 2002 SP3 Win XP HE *Follow-up to: microsoft.public.excel* Hi, I have the following: Columns A B C D E F G H I J Date Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 Field 7 Field 8 Field 9 12/31/1996 xyz 58979 23539 1880 1937 1837 1930 100 1/30/1997 xyz 58979 23539 1925 1965 1787 1822 -5.60% 94.40 2/28/1997 xyz 58979 23539 1925 1965 1787 1822 -5.60% 94.40 3/31/1997 abc 58979 23539 1925 1965 1787 1822 -5.60% 94.40 etc. I need to be able to modify the last column (column J) so that the number 100 starts at TODAY() - 1 year (the "-" is a minus sign) as we...