What's the difference between the TrackPopupMenuEx and TrackPopupMenu windows APIs?
I read about these APIs in this webpage: http://www.ex-designz.net/apicat.asp?apicat=34
I tested TrackPopupMenuEx and TrackPopupMenu APIs and they do the same thing: displaying a menu at the cursor's position. The source codes are the same, you just have to add or erase the "Ex" at the end of 开发者_Python百科the names of these APIs. Why two APIs for the same action?
Note: TrackPopupMenu crashes my app in runtime when used on an image control, while TrackPopupMenuEx works ok. TrackPopUpMenu seems to have no sense.
They are pretty similar functions but the big difference is that TrackPopupMenuEx allows you to specify a rectangle that the popup menu won't appear over (to have one that doesn't obscure what you need to see). Thats about it as far as i can see.
According to the documentation, there are some subtle differences:
TrackPopupMenu
has anReserved
parameterTrackPopupMenuEx
takes aLPTPMPARAMS
for the last parameter, butTrackPopupMenu
takes aCONST RECT*
(which is ignored)
So, they have a different number and type of parameters with different meanings - which would explain why your app is crashing when you change the call.
精彩评论