开发者

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:

  1. TrackPopupMenu has a nReserved parameter
  2. TrackPopupMenuEx takes a LPTPMPARAMS for the last parameter, but TrackPopupMenu takes a CONST 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜