What’s the deal with that alternate form for menu item template separators?

Raymond Chen

We saw last time that you can specify a separator in a menu item template by specifying zero for everything, even though technically you’re supposed to pass MFT_SEPARATOR for the flags. What’s the deal with that alternate form for menu item template separators?

This goes back to the early days of the InsertMenu function (and its friends like AppendMenu and ModifyMenu). In the Before Time, the way you specified a separator was to add a null pointer. Not a null string (a string with no characters, consisting only of the null terminator), but an actual null pointer.

AppendMenu(hmenu, MF_STRING, 0, NULL);

The recommended way of adding a separator is, of course, to use MF_SEPARATOR, but this old-fashioned method is still supported for backward compatibility. The alternate form of the menu item template for separators is just a throwback to the days when this “old style” of adding a separator was in fact the only style.

0 comments

Discussion is closed.

Feedback usabilla icon