Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - TrackPopupMenu uses sendmessage
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TrackPopupMenu uses sendmessage

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: TrackPopupMenu uses sendmessage
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2008 at 1:35pm
Hi,
What problem do you have with SendMessage ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 29 April 2008 at 5:12pm
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.