prompt for Windows global group - windows

I need to prompt for Windows user names and Window global group names in my application (C++).
If you right-click a file or directory in Windows Explorer, choose properties, go to the Security tab, click the Edit button and then the Add button, you get a standard screen to select (and validate) user and group names.
Is there any way to invoke this screen using the Windows API?

Related

How to set Environment variables from Windows

What is the way to add environment variables in windows xp, 7, 8 , vista, 10 etc
In Windows 7, 8, Vista or XP.
Find "My Computer" icon either on the desktop or in the start menu, right click on it, and select Properties item from the menu.
When you see the properties dialog box, click on the Environment Variables button then add it.
In Windows 10 or higher, open cmd from start menu.
Then execute this command "systemPropertiesAdvanced"
To view or change environment variables:
Right-click My Computer, and then click Properties.
Click the Advanced tab.
Click Environment variables.
Click one the following options, for either a user or a system variable:
Click New to add a new variable name and value.
Click an existing variable, and then click Edit to change its name or value.
Click an existing variable, and then click Delete to remove it.

How to run a keyboard shortcut via a file?

Certain programs for Windows have specific keyboard shortcuts that execute specific functions. I was wondering if there is a way to create a small file that can activate any shortcut by clicking on it?
Example: Win+C opens up the charms bar in Windows 8. Can I create a file to click on that opens this function for me?
(I want this file to activate a different keyboard shortcut, not the one mentioned above in my example.)
It looks like you are trying to create a desktop shortcut.
To do so:
Use My Computer or Windows Explorer to locate the object to which
you want to create a shortcut.
Right-click the object, and then
click Create shortcut.
Drag the new shortcut to an open area on the
desktop.
You can also create a keyboard shortcut that will open or do whatever that shortcut would do if you opened it. See properties.
Reference: https://support.microsoft.com/en-us/kb/140443 (page no longer available since Windows 10)

Issue with windows shell right click extension in folder background

It is very simple to add a custom command to the shell context menu like so:
[HKEY_CLASSES_ROOT\Directory\Background\shell\TestCommand]
#="My Test Command"
[HKEY_CLASSES_ROOT\Directory\Background\shell\TestCommand\command]
#="notepad.exe"
This adds a custom command to the right-click menu that launches notepad. Since I added it in Directory\Background\, my understanding is that the command should only show up when I right-click in the background of a directory (for example, right clicking an empty area in the right pane of Windows Explorer).
My issue is that the command is also showing up when I right click on an item in the left pane of Explorer (i.e. right clicking on a drive or folder in the treeview). Is there any way to prevent this from happening? I am launching a custom application with arguments and the result is unpredictable if the user is able to launch it from the left pane.
Add;
[HKEY_CLASSES_ROOT\Directory\Background\shell\TestCommand]
#="My Test Command"
"NoWorkingDirectory"=""

How to associate an extension with a program if the extension is not in the "Default Programs" list in Windows Seven?

In Windows Seven, I'm aware of the "Default Programs" dialog in Control Panel, which lets me associate pre-defined extensions with programs. However, I need to add an association for a file extension that isn't in the list. In WinXP, I'm pretty sure I could add entries to the list, but that doesn't appear to be immediately available in Windows Seven.
If you select a file with the desired extension in Explorer and click on it, a dialog box pops up that lets you select a program from a list. Click that. Then you can CLick on "Browse..." and select the program you want the file to be opened with. I have not tried, but you might be able to change it through the Default Programs afterwards.

Windows Explorer: How to create additional button?

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

Resources