How to create Dynamic Cascading Menus in windows explorer.exe? - windows

i know how to create Static Cascading Menus from here:
https://learn.microsoft.com/en-us/windows/win32/shell/how-to--create-cascading-menus-with-the-subcommands-registry-entry
now i want to create Dynamic Cascading Menus that use commands in */shellex/ContextMenuHandlers ,
how to do it ?
thanks!😘
link about "Dynamic":
Customizing a Shortcut Menu Using Dynamic Verbs - Win32 apps | Microsoft Learn
https://learn.microsoft.com/en-us/windows/win32/shell/shortcut-menu-using-dynamic-verbs

In your IContextMenu implementation you are handed a HMENU during the query, you may use the normal WinAPI menu functions to add submenus in whatever hierarchy you want.
See also:
How to Implement the IContextMenu Interface
The Complete Idiot's Guide to Writing Shell Extensions: Part I

Related

Menu-commands extension for Visual Studio without command-table

I am building a Visual Studio extension (VSIX) with menu commands depending on the options for the extension. Its dynamic, what commands (how many) depends on the options.
I have a solution for it that uses the command-table, like: Dynamically add menu items
I would like to skip the command-table and build the menus totally programmatically, like: HOWTO: Package with commands created by code
The reason is to make it more dynamic. So if the user adds/changes/deletes in the options of the extension it would be handled dynamically (programmatically). On saving options the menu-command tree would be rebuildt. If I use a command-table I will have to add/delete nodes there to be able to solve it.
The thing I can not figure out is howto add the objects for "groups" and "menus" programmatically.
So I am out for the class/interface that has "AddGroup" or "AddMenu" as methods.
Is this at all possible or do I have to use the command-table? If it is possible I would appreciate links to code-examples for it.
Regards Hans
MVP Carlos Quintero has published sample code using IVsProfferCommmands3.AddNamedCommand that illustrates how to programmatically add menu items via the automation services (formerly utilized by the now discontinued add-in extensibility model).
https://github.com/visualstudioextensibility/VSX-Samples/tree/master/PackageCommandsCreatedByCode
While add-ins are no longer supported, the automation interfaces are still present. So you can use these, bearing in mind these menu items (aka commands) are temporary.
Also, the sample code here is a little outdated, using Package instead of AsyncPackage, and ProvideAutoLoad attributes. So you'll also want to read up on the following:
https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration
https://devblogs.microsoft.com/visualstudio/updates-to-synchronous-autoload-of-extensions-in-visual-studio-2019/
Sincerely,

Advice on supporting screenreaders (fully) on a sliding widget (think iOS settings panels)

I am building a container with nested sliding sub-containers - which themselves will have their own set of nested containers.
Basically it will behave very similar to how iOS handles settings (see attached image).
I need some advice on how to go about this. What ARIA properties would you use? And how would you structure keyboard navigation?
.. is there an existing W3C recommended pattern I can lean against? Or do I need to re-invent the wheel on this one?
The WAI-ARIA Authoring Practices Guide is intended to provide an understanding of how to use WAI-ARIA to create an accessible Rich Internet Application. It describes recommended WAI-ARIA usage patterns and provides an introduction to the concepts behind them.
Source: - https://www.w3.org/TR/wai-aria-practices-1.1/#intro
From this spec it looks like this is the most relevant:
Menu or Menu bar
A menu is a widget that offers a list of choices to the user, such as a set of actions or functions. A menu is usually opened, or made visible, by activating a menu button, choosing an item in a menu that opens a sub menu, or by invoking a command, such as Shift + F10 in Windows, that opens a context specific menu. When a user activates a choice in a menu, the menu usually closes unless the choice opened a submenu.
Although it seems this may be in reference to a 'context menu' that you usually get by right clicking. But I don't see how this could be used for your use case.
The spec also has advice and guidelines for Keyboard Interaction.
You may also want to look at the Web Content Accessibility Guidelines Working Group wiki, which has an article on 'Using ARIA menus'

Is there a JPanel equivalent for MFC

Im my application I want to implement the feature of when a user click on a button show a Panel which will consist of some user controls. I know In Java I can easily use Jpanel and use setVisible() method to get this done easily. But this is an MFC application. I couldn't find any built or customized component that I can use for my purpose.
I also tried GroupBox. But it is not grouping the components logically.
What would be the best approach for this?
As user1793036 says, start by creating a dialog resource and CDialog derived class for the panel. In the dialog resource properties turn off the Title Bar style. In the code call Create for the dialog and then SetWindowPos to place it where you want it to appear.
MFC is nothing but a thin wrapper over Win32 API for windows and controls. The core Win32 API doesn't provide any feature to group controls in a group-box or panel. One way is to have a window and make that window parent of all required controls. Unfortunately, this isn't easy to do.
I suggest you, since you are learning, to drop the idea. Instead, learn what you can achieve with existing set of features provided by MFC/Win32. With MFC/Win32, you would, mostly need to derive/subclass a class/window to get something fancy (such as colored list-control).

Add to context menu for specific application

Is it somehow possible to add a context menu item for one specific application or can does the application somehow support this? If so what kind of support are we then talking about?
This is called a context menu handler, if I understand you correctly. You need to register it in the registry and, typically, associate it with a file extension.
It's all explained over at MSDN.
If you need to write code to support your context menu handler, then you will be able to find numerous samples of such on the web using the keywords contained in the MSDN documentation.

How can I add an editable ComboBox to Vista's Common Item Dialog?

Vista introduced the new Common Item Dialogs for opening and saving files that supersede the old Common File Dialogs. Custom controls can be added by utilizing the simple IFileDialogCustomize interface. One of them is a standard ComboBox which is non-editable. Is there any way to create an editable ComboBox or modify an existing one (by adding the CBS_DROPDOWN style)?
Unfortunately, you can't. There is no guarantee that the controls you add with IFileDialogCustomize are Win32 controls. (And in fact, I believe they aren't.) Since they aren't Win32 control, there's nothing to set the CBS_DROPDOWN style on. Sorry.

Resources