Date: | September 29, 2004 / year-entry #352 |
Tags: | tipssupport |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20040929-00/?p=37713 |
Comments: | 5 |
Summary: | On many context menus you will see an item in boldface. For example, if you right-click a text file, you will most likely see "Open" in boldface at the top of the mean. What does the boldface mean? The boldface menu item is the default command for that menu. It represents the action that would... |
On many context menus you will see an item in boldface. For example, if you right-click a text file, you will most likely see "Open" in boldface at the top of the mean. What does the boldface mean? The boldface menu item is the default command for that menu. It represents the action that would have occurred if you had double-clicked the item instead of viewing its context menu. In the above example, the fact that "Open" is in boldface means that if you had double-clicked the text file instead of right-clicked it, you would have opened the document. Programmatically, the default menu item is set via the SetMenuDefaultItem function and can be retrieved with the corresponding GetMenuDefaultItem function If you put a default menu item in a submenu, then Windows will invoke the default item in the submenu when you double-clicking the submenu's parent. But if you put a default menu item in a top-level menu (i.e., not on a submenu), then it is your responsibility to invoke the default menu item when the user double-clicks the object that led to the menu. (This last bit should be obvious: It is the code for the object being clicked on which decides what to do on a double-click.) We'll see more about default menu commands next time. |
Comments (5)
Comments are closed. |
Slightly off topic, how do you designate the default command in the registry? For example, a text file has the key
HKEY_CLASSES_ROOTtxtfileshell
with subkeys EditWithVS, open, print etc. The open command is the default in Explorer when a txt file is right clicked.
Set the default value of HKEY_CLASSES_ROOTtxtfileshell to the name of the command you want to be default.
I get this dialogue box-please, what does it mean?
I get this dialogue box-please, what does it mean?
There’s a logic behind it, although not everybody follows it.