Windows 11 add custom buton on new context menu (right click menu) - windows

On Windows 10, I had created a button in the menu that called a python script (see project). I had managed to do this by modifying values in the registry editor.
My button still appears on Windows 11 but only on the old menu and not the new one. You must now click on “More option” to display all the options.
I know it's possible to disable it on the new menu but I don't want to, I really want to add a button on the new. I think it is possible by modifying data in the register editor.

Microsoft changed Windows 11 on purpose to prevent people from easily adding entries to the context menu.
The only way to display your item in the new context menu is to implement a IExplorerCommand COM object and on top of that, your application needs to be packaged (app identity with a sparse manifest) and signed with a valid certificate.
This was announced on the Windows blog last year in this post.

A tool that allows you to add elements on new context menu
https://github.com/ikas-mc/ContextMenuForWindows11

Related

How to add function to the mouse right-click menu in desktop

desktop: window server 2003
Assume i have a cmd.sh that echo a message, here i want to run it in anywhere , when i right click the mouse and choose the echo function.
hope for your answer, thanks
Editing the registry as #dbvega indicates works if you always want the same menu item to appear. This is called a static menu. But if you want to do have more control over your menu item, such as changing the visibility, text, and icon depending on various runtime conditions, you need to create a dynamic context menu shell extension, which involves programming a COM object. This MSDN article describes the difference.

How do I modify the "Add" sub menu items in solution explorer?

How can I modify the items that appear in the solution explorer "Add" context sub menu? Currently there is New Item, Existing Item, New Folder, then Windows Form, User Control, then Component and Class. I especially want to get rid of the 2 WinForms items and replace them with their WPF counterparts. How do I do that in the easiest way?
You can modify the Add sub menu you get when you right click on a project item from the Tools->Customize... menu:
click on the Commands tab
pick the 'Context Menu' radio button
select Project and Solution Context Menus | Project | Add from the combo box
From here you can modify the context menu.
This is not, however, what you want to do in your particular case.
The WPF commands you want are already in that context menu; you'll see WPF commands like "Add Window" and "Add Page" already present in the Customize dialog if you go through the instructions above. The reason that you don't see them in the actual context menu is because Visual Studio is trying to be smart and it thinks that you're developing a WinForms app and not a WPF app. If it thought this was a WPF app, you wouldn't see the windows forms option (and the user control option would create a WPF user control).
In order to correct visual studio's incorrect assumption, you could make a new project - make sure you pick that you want a WPF app - and add all of your existing files, or you can edit your .csproj file: see my answer to this SO question.

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...

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