Explorer of Windows 7 uses a new light-blue bar with buttons like "Organize", "Share", "New Folder" etc.
How can I create a new button ? Do I need to create a plugin for explorer.exe, and if, how do I do it (using Visual Studio .NET) ?
Or is it a simple registry key I have to set which points to an exe or bat?
Thanks in advance and best regards
It's a registry key, but not quite so simple. You have to do several steps to add one button.
You may have noticed that the Win7 Explorer adjusts its toolbar to match the content that is being displayed. For example the buttons shown for the control panel folders are different than the ones for documents or the music library folder. You can find a large list of different folder types under the registry key
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes
Click on each UID shown there to find out what folder type it is for. For example here you see the entry for folders in the generic library type:
So the first thing you have to do is to find the folder type for which you want to add your own button.
Once you found the right UID, you might have to take ownership of those keys. Otherwise you won't be able to modify them:
Right-click on that key and choose Permisssions...
Click the Advanced button.
Click the Owner tab.
Under Change Owner to: select Administrators.
Click Apply and verify that "Current Owner" is set to Administrators.
Click OK to save the change.
Back in the Permissions dialog, click Administrators and then click (to check it) Full Control
Click OK to save the settings and close the dialog box.
The next step is to create the keys and values necessary for your own button:
Add a new key, TasksItemsSelected
Add a new key, TasksItemsSelected\0
Create a new GUID (use guidgen.exe) for your command.
add the key TasksItemsSelected\0\<yourguid>, then add the strings Title and InfoTip and give them the appropriate values. You can also set an icon here, using the string Icon with the value pointing to an icon file.
Add the keys TasksItemsSelected\0\<yourguid>\shell\InvokeTask\command
as default value of the command key, enter the command you want to execute.
Now your registry entry should look something like this:
When the command runs, it will receive at least two parameter values.
%1 -- The path of the folder that was being displayed
%2 -- The pathname of the file that was selected.
If you select more than one file before clicking the mycommand button, then the subsequent filenames will be in subsequent parameters.
And last but not least: if you want to add your own button for situations where nothing is selected, do everything as mentioned above, but use the registry key TasksNoItemsSelected instead of TasksItemsSelected
Related
I would like to create an extension for VS Source Control Explorer context menu,
In order to add an option on the Text Editor context menu I know you need to set IDM_VS_CTXT_CODEWIN on Group's Parent node into the vsct file.
Can someone tell me the correct value for Source Control Explorer context menu?
I don't think that particular context menu guid:id pair is published anywhere. I usually try searching the various .VSCT files under the ….VSSDK\VisualStudioIntegration\Common\Inc directory to find a unique menu item in the context menu, figure out what menu group it's parented to, and work back from there.
But given the thousands of commands and menus wired into the IDE, this can be a hit or miss scenario.
When a search of the various .VSCT files on the above mentioned path doesn't pan out, I usually revert to using the EnableVSIPLogging registry key, to discover the guid:id pair for the given context menu.
Easiest way to set this is to install Mad's Extensibility Tools extension, which adds an "Enable VSIP Logging" command on the IDE's main "View" menu. Once you set this, if you hold down the CTRL+SHIFT keys, while right clicking in the Toolwindow, you'll get a diagnostic message box, with the guid and id of the context menu. You can use these as the parent for the menu group containing your command.
For example:
VSDebug Message
Menu data:
Guid = {**FFE1131C-8EA1-4D05-9728-34AD4611BDA9**}
GuidID = 962
CmdID = ***4113***
Type = 0x00000400
Flags = 0x04000000
NameLoc = (null)
OK
Where FFE1131C-8EA1-4D05-9728-34AD4611BDA9 is the context menu guid, and 4113 is the menu id.
Note, if you hold the CTRL+SHIFT while selecting an actual command, the same dialog will appear, but the guid and cmdid, will identify the specific command(menu item) selected.
Sincerely,
how to add new items to certain file extension context menu (to .mp3 files for instance)
I've also noticed that there is common items in all context menus across the windows, does they all share/inherit one context menu ? where is it : which one is for text
what such keys are called and how to generate them (for instance {11dbb47c-a525-400b-9e80-a54615a090c0})
also is there a good brief reference for the registry that you would recommend ?
Type regedit in RUN dialog box or Start Menu searchbox and press Enter. It'll open Registry Editor, now go to following keys:
HKEY_CLASSES_ROOT* (for adding an option in All files context menu)
HKEY_CLASSES_ROOT\Directory (for adding an option in folders context menu only)
HKEY_CLASSES_ROOT\Drive (for adding an option in Drives context menu only)
HKEY_CLASSES_ROOT\Unknown (for adding an option in unknown files context menu)
Now under the above mentioned keys, you'll find "Shell" and "Shellex" keys. Both keys contain various entries, which are displayed when you right-click on a file, folder or drive. We'll use "Shell" key in this example:
Right-click on the "Shell" key and select "New -> Key".
Give it any name. Suppose we gave it name "Demo".
Now in right-side pane, double-click on "Default" String value and set its value to the Label which you want to display in context menu. Like if you want to add "Winamp" in context menu, then you can give it name "Open with Winamp" or similar.
Now create another key under this newly created key "Demo" with the name "command" and in right-side pane set value of "Default" to the path of application. For ex, for winamp you can set its value %programfiles%\Winamp\winamp.exe.
A full reference to this can be found here
how to add new items to certain file extension context menu
How you massage the registry to create context menu item entries is already covered by this MSDN article. It is extensive and well done, no need to repeat it here.
I've also noticed that there is common items in all context menus across the windows
The majority of them are baked-in items that Explorer itself understands. There is a backdoor to add an item yourself to any file, the HKCR\* registry key is used. Use this sparingly, it is pretty annoying to users.
for instance {11dbb47c-a525-400b-9e80-a54615a090c0}
That's an example of a custom shell extension handler, you found this one back in the HKCR\Folder registry key, the key that adds items to any directory. Think of it as a plug-in that adds capabilities to Explorer that it doesn't have itself. The {guid} selects the executable file that Explorer loads to implement the item. Navigate to HKCR\Classes\CLSID\{guid} to see that file, you'll see it is implemented by c:\windows\system32\explorerframe.dll
Writing your own shell extension handler is not that easy, it requires COM coding skills in C++. A coding technique that is getting obscure. Using something like C# is technically possible but strongly discouraged by Microsoft and they won't support it. You need to write an in-process COM server that implements the IContextMenu interface. Programming guide is here.
I have a partition for photos and at some point one of my little brothers encrypted almost half of the photos(via Right click on folder-> properties -> advanced -> encrypt).So now i have some 15 folders with photos that i can't open. I did not observe the change and i changed the OS. Now when i try to open a photo it says "Access denied!". The photos appear now with green title and in properties, they have the encrypted radio button checked and grayed. Is there any chance to recover these files?
Please try below step to enable the encrypt radio button.
In my case I checked with window 8 OS.
1. Press Windows Key + R combination, type put regedit in Run dialog box and hit Enter to open the Registry Editor.
2. In the left pane of Registry Editor, navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
3. In the right pane of above shown window, look for the NtfsDisableEncryption named registry DWORD(REG_DWORD), since you’re facing the issue, you’ll find that this DWORD having its Value data set to 1. Double click on the same DWORD to modify:
4. In the above shown window, change the Value data to 0. Click OK. You may now close the Registry Editor and reboot to get fixed.
For additional reference click this Enableing encrypt option
I'm working with InstallShield 2013 Professional, Basic MSI Project.
My installation package contains exe file - myfile.exe. I added shortcut for it in Shortcuts view specifying myfile.exe as Icon File, and 0 as Icon Index. The destination place for this shortcut is a Desktop on a target box.
Suppose, my executable contains 3 icon resources and I want to change icon dynamically during Installation. To be more clear what I want to do: I have 3 radio buttons on one of Installation Dialogs and I want to apply icon to myfile.exe shortcut depending on radio button that was checked (1-st radio button->1-st icon, 2-nd radio button->2-nd icon, 3-rd radio button->3-rd icon).
How can I get this behavior? In other words, how can I change icon index of Icon File during installation?
This is kind of a complicated request. An easier way of achieving this would be to compile the EXE three times with different names and different icon 0 resources and then use mutually exclusive component conditions to control which one gets installed.
It gets trickier if that's not an option. The Shortcut Table defines the IconIndex column as an integer and is not formattable. This means you can't say [ICONINDEX] in the field and let it resolve at install time.
So what can you do? You can use a custom action to dynamically emit table data into temp tables during the install. An example using C# can be found here at: Dynamic Windows Installer UI
Realize that if someone creates a shortcut by hand they are likely to pick the "wrong" icon.
I have an application that gets installed with a Wise installer (EDIT: Wise creates a Setup.exe file, not an MSI). Upon installation, an icon is set for a certain file type:
HKEY_CLASSES_ROOT\.auz\DefaultIcon = C:\Path\To\App\some_icon.ico,0
Right after the installation, however, Explorer chooses to display this icon using the generic "white sheet + application icon" icon, which is different (and not provided by me).
Upon first launch, the application itself registers icons and other file associations, so that the last run version "owns" those documents. At that point, Explorer changes the icon for this file type and displays the correct one, but when I look at the registry, the value for DefaultIcon is exactly the same.
This is what I've tried so far
Removing all entries from the registry, and writing them myself.
After the installation, "touching" the value of DefaultIcon, and then launching a small little program that only calls SHChangeNotify(SHCNE_ASSOCCHANGED) (my program does this after updating the file associations in the registry).
After the installation, killing and restarting Explorer.
After the installation, using TweakUI to "repair" the icons on the desktop.
None of these work. The only way to get the correct icon is to let the program itself install it. I can't find any change in the registry. I'm pulling my hair off.
What I would like to avoid
Testing with another installer software
Changing the installation script too much (I don't have Wise itself, as the installer gets built on another machine on demand).
Embed the icons in the executable.
Any suggestions on how to get Explorer to display the correct icon after installation?
A couple of things come to mind:
why do you have the ',0' after the icon in the registry? That would limit the shown icon to one single icon. Better would be to have an icon file which contains several icons (same icon UI but different sizes/color depths) - Explorer has different icon views! Try removing the ',0' if your icon file only has one icon in it.
it may be that the registry is written last in the installer, after the explorer got notified of updates?
make sure the registry entry is written after the icon file is stored on disk
you should use the Wise installers own configuration to register the file type. Not sure, but I think explorer won't take any changes until the whole installation of an msi is finished, so calling SHChangeNotify() manually won't help. The msi has its own table for this, which Wise will add if you use the right configuration.
For Wise, do the following (instead of creating the registry keys on your own):
Under the Feature Details page group, select the File Associations page.
From the Current Feature drop-down list, select Core.
Click Add at the right of the window and select New.
The File Association Details dialog appears.
Click the Extension Details tab.
Browse to the QuickFacts directory, select the file QckFacts.exe, and click OK.
In Extension, enter: qft
Leave the defaults for the rest of the fields and click OK.
The extension .QFT is added to the installation. When an end user double-clicks a
file with this extension on the destination computer, the QuickFacts application
launches.
Save the installation
[Edit]
You may also missing required registry entries (the icon might not be enough for the shell to show it):
HKEY_CLASSES_ROOT\.auz\(default) = auzfile
HKEY_CLASSES_ROOT\.auz\shell\open\command = C:\Path\To\App.exe
Here's the solution.
Each file type (let's say ".auz" in this case) was registered with:
A DefaultIcon key with the path to the icon resource, and
A value for the HKEY_CLASSES_ROOT\.auz\(default) value giving a description of the file type, e.g. "Foobar Document".
In addition to this, there was an entry for the "Foobar Document" document type, or more specifically, a key for how to open such documents from the shell:
HKEY_CLASSES_ROOT\Foobar Document\Shell\command\open\(default) = C:\Path\To\App.exe "%1"
Apparently, this key supersedes the value written for the specific file extension. Because the icons are external to the .exe file, Windows Explorer then used the first icon of the application to create an icon for all files of type "Foobar Document" (that "white sheet + application icon" icon I mentioned).
Now, what I had wrong was that the application itself does change the value of
HKEY_CLASSES_ROOT\.auz\(default)
to a slightly different value when starting, say "Foobar 1.2 Document" (the problem with not being DRY). Thus, the link to "Foobar Document" was lost, and the .auz files got their icons after the first launch.
So I fixed this all by simply removing the HKEY_CLASSES_ROOT\Foobar Document key altogether, and voilà!