Grey Out Windows Context Menu Entrys - windows

Is there a way to "Grey Out" or disable Windows Context Menu entrys?
I created a few entrys by adding them in the Windows Registry. So far so good. But they should not always be clickable (but still visible).
Googling this problem didn't help me. An Example is the Right-Click Menu of the Recycle Bin. When it's full the "Empty" -Entry is clickable, when it's empty it's greyed out.

You're looking for Shotcut Menu Handlers (MSDN) or Shell Extension Providers (MSDN)
It's not just about INI files and Registry entries. You'll need to implement a COM object that adheres to some interfaces, e.g. IContextMenu.
A useful utility is NirSoft ShellExView.

Related

Using old toolbars in Excel 2010 and Windows 7

I have a toolbar with some actions linked to macros in Personal.xls. I want to use the toolbar in Excel 2010 under Win7, but it insists C:\Documents and Settings\user\App...\PERSONAL.XLS doesn't exist. Quite right, they've changed the %AppData% location to C:\Users\user... And I can't put a copy of PERSONAL.XLS in the old place because C:\Documents and Settings\ is special-cased in Windows 7, and it's a forbidden place to everyone.
My question: How can I reset the macro linked to the toolbar buttons?
You used to be able to access
the Commandbars collection to get a command bar
The Controls collection of the command bar to get a control (button in this case)
The OnAction property of the control to identify the linked macro.
But OnAction doesn't seem to be a supported property for Excel 2010.
Any suggestions?
I'd much rather relink the toolbar than create a new custom ribbon tab. The toolbar buttons don't waste the APALLING amount of space custom ribbon items take up, and the custom icons on my toolbarare meaningful. Subsiduary question: Are there simple ways to create custom designs for custom ribbon items?
Looks like I didn't investigate closely enough. "OnAction" might not appear in the Object Browser, but it is available, and can be used to reset the associated toolbars. It didn't seem to work using the Immediate window, but does work within code in a module.
Cheers folks...

How to add item to windows explorer content menu in delphi?

I would like to create menu item in windows explorer content menu (for all file types) which after click will open my application and pass the selected file name to it. Is there any tutorial for this ? I know there is ShellPlus component available but it's a bit outdated.
Registry
This method is easy since it comes down to adding some registry keys. The downside is that you can't put any logic in it. You can read about it here and here a simple example in Delphi. You get a bit more control if you are using DDE to execute the menu items. See here for a Delphi example.
Shell Extension
This method is a bit more work, but you can completely control the context menu from code. You would have to write a DLL, implement IContextMenu (or others) and register the dll with Windows Explorer. You can read about it here. You already mentioned Shell+.
Delphi includes a demo project for shell extensions. Look in the Demos\ActiveX\ShellExt folder.
This is possible independendly from the programming language by setting up shortcut menu handlers for the desired filetype(s) in the registry. There you can call your application with the correct path, the correct options and the right file-placeholders.
See the MSDN article on Creating Shortcut Menu Handlers for more detailled information.

Is it wrong for a context (right click) menu be the only way a user can perform a certain task?

I'd like to know if it ever makes sense to provide some functionality in a piece of software that is only available to the user through a context (right click) menu. It seems that in most software I've worked with the right click menu is always used as a quick way to get to features that are otherwise available from other buttons or menus.
Below is a screen shot of the UI I'm developing. The tree view on the right shows the user's library of catalogs. Users can create new catalogs, or add and remove existing catalogs to and from their library. Catalogs in their library can then be opened or closed, or set to read-only.
The screen shot shows the context menu I've created for the browser. Some commands can be executed independently from any specific catalog (New, Add). Yet the other commands must be applied to a specifically selected catalog (Close, Open, Remove, ReadOnly, Refresh, Clean UP, Rename).
Currently the "Catalog" menu at the top of the window looks identical to this context menu. Yet I think this may be confusing to the users as the tree view which shows the currently selected catalog may not always be visible. The user may have switched to the Search or Filters tab, or the left pane may be hidden entirely.
However, I'm hesitant to change the UI so that the commands that depends on a specifically selected catalog are only available through the context menu.
The Windows User Experience Interaction Guidelines for Windows 7 and Windows Vista states (pg233):
“Don’t make commands only available through context menus. Like shortcut keys, context menus are alternative means of performing commands and choosing options.”
The Apple Human Interface Guidelines states (pg189):
“Always ensure that contextual menu items are also available as [pulldown] menu commands. A contextual menu is hidden by default and a user might not know it exists, so it should never be the only way to access a command.”
In your case, opening and closing the catalogue appears already available through the +/- buttons in the tree itself, so you’re already consistent with the Windows guidelines, if not the Apple guidelines. IMO, the only reason to put them on the context menu at all is if they're the default (double-click) action (which they're not right now). Rename may also already be available by directly selecting the name of a selected catalog, but you may want a pulldown menu item for that any way since that may be no more discoverable than the context menu. The rest of the commands probably belong on a pulldown menu in addition to the context menu.
As far as the Catalog pulldown menu being redundant with the Catalog context menu, you may want to consider organizing your pulldown menus by type of action, rather than class of object, in order to provide an alternative organization. As you’ve realized, context menus already organize commands by class of object. In addition to providing an alternative organization that some of you users may find more intuitive, this may simplify your menubar. For example, rather than a Catalog and Family menus, you can have a single Edit menu with Add, Delete, Rename, Copy, etc. where these commands apply to whatever is selected, whether it be a catalog, folder, or family. If they don't apply to the current selection, they're disabled, but if it makes any sense in your app, make them apply.
BTW, what’s the difference between Add Catalog and New Catalog?
In general, it's a bad idea to have menu items accessible only through a contextual menu. Many users may not think to right click on an item to find out what actions can be performed on an item.
From your description, it sounds like it would make sense to have a 'Catalog' menu that disables menu options that are not currently relevant. For example, if no catalog is open, the 'Close' menu item would be greyed out. Similarly, the 'Open', 'Remove', 'Refresh', etc. items would be greyed out if no catalog is selected.
I suppose this depends on your user base, and who you're targetting your software at. Personally I wouldn't expect the user to be able to deduce what functionality is available when it is essentially "hidden" until they right-click on the correct item.
If it were me, I'd have a toolbar shown with the functionality exposed on there. By default the buttons would be disabled, and clicking on a node would enable the appropriate buttons based on the context. You could have this in addition to your current right-click options.
As a rule, I've always treated right-click menus as a redundant (i.e not necessary for operation of the software) shortcut to functionality for "power users".
I would leave the menu item out because the user doesn't have a way to see what catalog they are modifying if the treeview is hidden which can create problems if they think a different one is being shown.
Though, the accessible solution would be to trigger it with the keyboard also.
Yes. One key feature of UI is "discoverability": can the user find the function?
If you think that having a top-level menu doesn't make sense, based on the context, then you could have a menu button (scroll down) labelled (e.g.) "Actions" at the top of the pane.

Where do I put my Office Add-In configuration page(s)?

I'm writing a COM add-in for Word, Excel and PowerPoint. This add-in has some user-configurable settings (about a page full of them actually... or perhaps even more than a single page). What is the standard way of presenting these to the user? Through a custom page under Tools->Options? (how?) Under a custom button on a custom toolbar? A specific menu for the add-in?
If it were Outlook, I would add a custom property page. I was pretty confident I could easily google something similar for the other office application, but I'm obviously not searching for the right terms. Hints to improve my searching are also very welcome!
Update:
I just realized one can figure from your question you are targeting Office versions up to and including 2003 right now, as for example the tools menu is gone in 2007.
You might still find an answer regarding your question by looking at the starting point for the mentioned migration from 2003 to 2007: access to the settings for the sample 2003 add-in is located in an add-in specific sub menu of the tools menu, as shown in Figure 7.
For current and future versions of Office (i.e. 2007 and up) your first stop regarding user interface questions should be the Office Fluent User Interface Developer Portal, specifically you'll find there the '2007 Office System Document: UI Style Guide for Solutions and Add Ins'.
Its probably worth pointing out that this guide is not on par with the Windows User Experience Interaction Guidelines (UX Guide) by a huge margin, which is unfortunate given the almost traditional friendly competition between the Office team and other Microsoft departments in setting the next de facto UI standard for 3rd party developers.
Still one can figure out initial directions from there, for example the recommendation regarding scenarios for custom task panes as suggested by Gary clearly is at odds with your need to offer user settings, citation:
Create a custom task pane if…
Your solution needs to present data
about a document that is required to
be visible, in a non-modal fashion,
use a custom task pane. [...]
You can find a good starting point regarding your question in section Simple Migration, where the migration of a simple 2003 add-in to the current 2007 release is explored step by step from a UI design perspective; not surprisingly this add-in features settings too, hence your requirements are addressed, albeit only on the side.
Reproducing this section here would be a bit lengthy plus I'm not sure whether it would be legal to reproduce the inline images used there, just look for Figure 9 in particular to get you started.
You can take it further from there depending on your particular scenario, good luck!
I'm pretty sure you cannot add a tab to Word, Excel and PowerPoint's Tools | Options dialog. I know you cannot do that in Word before 2007 at least.
I would recommend adding a menu item for your add-in somewhere, probably under the Tools menu. I assume your add-in does not already have any other menu items? I would put it in a menu item rather than a toolbar button, since most users don't need to change "settings" all the time, so they do need to look at the button on the toolbar all the time. My screen shots here show the menu in Word with Options at the bottom, though not the actual options dialog: http://www.amosfivesix.com/timken-business-stationery
If you're worried about people finding your menu item tucked away on the Tools menu, you can have a window pop-up the first time the app is started after your add-in is installed. Have it show a picture of where the menu item is, or just explain how to get there. Lots of apps have things like that the first time they run. One of my larger Outlook add-ins does have it's own menu on the menu bar (so it's fairly easy to find) but I also have a first run window that explains what/where it is. You can see an example of that here: http://www.amosfivesix.com/timken-electronic-business-card
Gary McGill's idea for a task pane might be good as well. I don't have any experience with task panes. I'm not sure it would be appropriate for "application settings" since taks panes are more like modeless dialogs that you work with while also working with the document content. Changing your add-in's settings probably doesn't work that way.
I don't know if there is a standard way. I have only created VBA add-ins, and I do not believe it is possible to add custom pages under Tools | Options.
In an Excel Add-In I created, I put a 'Settings...' button on the Add-Ins toolbar (the Add-In created a custom toolbar during the _AddInInstall event).
But this approach of course means your add-in must have a custom toolbar (or menu).
I did a quick check on an Office installation I have access to, that has a few Add-Ins:
The Adobe PDFmaker add-in has its own top-level menu, as well as a toolbar. The menu has a 'Change conversion settings' menu item
A custom add-in (eye-share, don't know what it is) also has its own top-level menu. The menu has a 'Settings...' menu item.
Hummingbird (some sort of document management system) has menu items all over the place, but no settings dialog. The installation program probably sets the necessary config values in the registry.
So my conclusion is:
You cannot add a custom page under Tools | Options (I guess Adobe would have done this if possible).
If your add-in has a custom menu or toolbar, add a 'Settings...' button or menu item (don't know if there is a standard icon for this)
If your add-in does not have a custom menu or toolbar, I would probably add a single menu item under Tools.
If you don't want to clutter the Excel interface, you could have an external program (created in .NET or whatever) installed on the Start Menu that updates the registry. This of course requires that all relevant settings can be represented as registry values, and are to be persisted. It also means that the Add-in should always look to the registry for settings values when performing operations - not read the setting at startup and cache it in a variable.

Adding item to the Desktop context menu in Windows

I want to add an item into the Desktop context menu (the menu you see when you right-click on an empty space on the Windows Desktop).
Something like Catalyst Control Center in this screenshot:
I know how to add items to files' and folders' context menus through registry, but the Desktop seems to work differently: I didn't even find the text in the registry.
So, how can I add a new item into the Desktop menu and how can I associate some code with it?
I think the solution is language independent, if it's not, I'd appreciate any code that helps.
Such a handler must be registered in HKCR\Directory\Background, instead of usual locations like HKCR\Directory, HKCR\Folder, etc.
Check out Creating Shell Extension Handlers in MSDN.
There's a series of articles on CodeProject that details writing Shell Extensions and is very good:
http://www.codeproject.com/KB/shell/shellextguide1.aspx

Resources