![]() |
TrackPopupMenu uses sendmessage |
Post Reply ![]() |
Author | |
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() Posted: 24 April 2008 at 11:48am |
Why does a command selected from a menu when TrackPopupMenu(Ex) is called get started via SendMessage instead of the windows and MFC way, which in my experience is via PostMessage?
Is this a bug?
It sure was unexpected on my part! So now I wonder why it is this way in case there is something I just don't get about the CJ paradigm.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
What problem do you have with SendMessage ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
SendMessage does not allow the stack to unwind before the WM_COMMAND message is handled. This can cause lifetime issues if a dialog or a command initiated the menu display.
I changed our usage of the function so that I always get the command id returned from the call. I then call PostMessage myself.
This was just totally unexpected on my part as Windows and (now) MFC always call PostMessage but easily handled to give us back the behavior we are used to by adding the TPM_RETURNCMD flag to the call.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |