Windows 8 does not seem to persist sort orders on individual folders. I'm guessing when explorer.exe terminates (like when rebooting) these preferences get discarded? Beats me, all I know is after a time (like a few days) those preferences get totally lost.
Is there a way to duplicate programmatically sorting folders in Windows Explorer (opting one of the 'Sort by' options in the context menu)?
Such that, say I have a folder opened in the Windows UI. Say the folder is currently set to sort by 'Name' and after running the program which will sort it by size I check the sort order in Windows Explorer again and it now says 'Size'?
I have a certain big folder structure that I want all of it and its subfolders sorted by size permanently. So I would like to run this program before viewing them and not have to individually manually re-sort them all first. Thanks!
The sort order belongs to the view, not folder. You can have two Windows Explorer windows open on the same folder, each has a different sort order.
To force a sort order when Windows Explorer navigates to a specific folder, first hook the DShellWindowsEvents::WindowRegistered event on the shellwindows object, then each time when the WindowRegistered event triggers, enumerate through the shell window list and compare with your existing enumeration to find the new windows explorer instance. Once you get hand on the new instance, hook up the DWebBrowserEvents2::DocumentComplete event for that instance to listen to its navigations.
When a navigation is complete, the DocumentComplete event will give you the target URL which you can use to detect if the target is inside your big folder structure. If so, query the IShellBrowser service from the windows explorer instance, then call QueryActiveShellView to get the shell view. Once you get the shell view, QI for IFolderView2 and then call SetSortColumns.
The Automate the Active Windows Explorer or Internet Explorer Window sample on codeproject has most of the code, except that it calls IShellView::SelectItem to simulate SHOpenFolderAndSelectItems at the end.
You can save Explorer sort settings by holding CTRL while clicking on that X on top right.
http://blog.chron.com/helpline/2009/01/saving-explorer-sort-order/
Related
So I split my window from the main tab group via IPropertyStore via SHGetPropertyStoreForWindow like so:
IPropertyStore_SetValue(pps, PKEY_AppUserModel_ID.address(), 'Contoso.Scratch');
pps->Commit();
Then the user later decides he wants to rename it so with my feature he does:
IPropertyStore_SetValue(pps, PKEY_AppUserModel_RelaunchCommand, customLaunchPath);
IPropertyStore_SetValue(pps, PKEY_AppUserModel_RelaunchDisplayNameResource, 'my first name');
pps->Commit();
This works successfully for the first time. But if he wants to change just the RelaunchCommand and RelaunchDisplayNameResource again it won't work unless I change the ID as well.
I gave RelaunchCommand and RelaunchDisplayNameResource as exmple here, in my real case scenario the user ALSO wants to change the icon but the same issue, it works a first time per ID. Anyway to run multiple times without having to change ID every time?
Thanks
PS:
The other big reason for this solution, is that one of my windows already has a System.AppUserModel.ID and is already pinned. I want to just change the icon/relaunchCommand/etc, if i change the System.AppUserModel.ID then it will effectively unpin it. :(
The solution to this topic is the workaround I am using:
Detecting Application Pin State
Before setting property I test if it's pinned by looking in folders of:
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
And I do a IPropertyStore::getValue on all the shortcuts, if it matches my AppUserModelID, then I change the icon, label, etc on that, which right away updates it in the taskbar.
This works but I'll leave this solution unaccepted as it's not documented so probably not the right way to go about it.
If the AppUserModel.ID is not found among the shortcuts, the i just to IPropertyStore::setValue on the windows of my application (I have to do on each window, i cant find a way to do it across the whole application)
I am trying to check a Windows Explorer view to see if a file name is currently being renamed / edited when typing.
I have a system hook installed that monitors the keyboard for specific keystrokes and fires certain events. This is done in this manner:
If the keyboard hook sees the key pressed it fires a message to another thread and continue processing other system hooks.
Other thread receives the message and checks to see if an Explorer window is active and gets the interface to the IFolderView2.
Call IFolderView2::GetFocusedItem() to get the focused item in the folder view.
Check if the focused item is being renamed / is in edit mode (SVSI_EDIT) using IFolderView2:: GetSelectionState() - this is the part that fails
If not in rename mode perform an action on that file.
I've tried everything on Windows 7 but the SVSI_EDIT flag (0x00000002 specifically) is never returned. It's always (SVSI_FOCUSED | SVSI_SELECT) regardless of if the file is being renamed. Setting the SVSI_EDIT flag with works with IFolderView::SelectItem with the flag puts it into rename mode but I want to determine if it's in this mode already.
This has only been tested on Windows 7 x64 so far.
Does anyone know a way to determine if Explorer / the IFolderView etc. is currently in the rename file state? Any sneaky method will do if it's not possible through these interfaces.
If one file in in renaming mode, Windows will create a EDIT control at the position of the item. So things got straight:
Find the currently-focused control.
Get the CLASS of the control.
Check whether it's CLASS is an EDIT.
On CodeProject there is a great example about how to find the focused control. To get the CLASS name of that control, use GetClassName API.
Does anyone know (Because on microsoft forums nobody answered me), how can I find what app has which automaticDestinations-ms file in %appdata%\microsoft\windows\recent\automaticdestinations ?
That's the folder where Windows 7 stores its jump lists, and I want to know how to automatically/programmatic find the relation between each file and an application.
At least, even manual I didn't found any pattern, just to look after file extensions in the files, because some programs open files with the same extension (like images), so this method it's not OK for all programs.
Do you have any other idea? Maybe knowing the format of those files?
Thanks.
the GUIDs appear to persist.
I was trying to edit my control panel jumplist - I found where the "Realtek HD audio manager" control-panel-applet-title-string is (using resource hacker on "C:\Windows\System32\RTSnMg64.cpl"), and restored it's original title ("Dell Audio" - 'cause I'm OCD:) but the original pinned Realtek entry is stuck.
A quick filesearch for pinned took me to
C:\Users\Jonny\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned
but I really needed to be # C:\Users\Jonny\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations
If you use something like Nirsoft's Jumplist View you can see the entries etc. Sort by "application ID" column to see jumplists by application. You can even change the monitored folder (advanced options).
I'm going to have to delete and recreate my control panel jumplist (7e4dca80246863e3.automaticDestinations-ms).
TIP: If you're not sure which is which, try pinning a new jumplist-entry to an application. This will appear at the top (if sorted by "record time")
The best way to find out is to sort the files by date modified, then interact with your machine, eg open a file with Powerpoint, look and see what file moved to the top. That is probably the file for Powerpoint, which you can confirm by opening it and looking in it.
Then you could build a table of magic guids, and search for those in the registry to see if there is an obvious key connecting the guid to an application id.
Here is a list of 620 applications here with the corresponding App ID byEricZimmerman
https://github.com/EricZimmerman/JumpList/blob/master/JumpList/Resources/AppIDs.txt
eg 0a1d19afe5a80f80|FileZilla 2.2.32
last update 12 days ago
In Vista, I have been using an IFileSaveDialog to let users pick a "save-as" folder. Users export a folder of images, say, and need to choose a new or existing target folder.
Briefly, the code goes like this:
IFileSaveDialog* dialog; // created
dialog->SetOptions(FOS_PICKFOLDERS);
dialog->Show(NULL);
dialog->GetResult(&shellItem)
In Windows 7, the FOS_PICKFOLDERS option appears to have been disallowed (and is marked as such in the API). The return value on the SetOptions call is E_INVALIDARG. If I use a IFileOpenDialog, I'm allowed to set the folders option, but the user is prompted with an error when choosing a nonexistent folder (despite my setting flags suggesting not to do this).
Is there an alternate way to get the new IFileDialog to act as a "save folder" dialog?
[To head off some comments, the SHBrowseForFolder API still exists, but is still not an acceptable solution for our UI deciders.]
The reason for this can be found in the documentation:
FOS_PICKFOLDERS: Present the Open dialog offering a choice of folders rather than files.
Using FOS_PICKFOLDERS for "save" was never supposed to be supported - but Vista didn't enforce it. Use IFileOpenDialog instead and you're good to go.
You are picking an existing folder (not specifying a folder to create), so open was always the correct choice.
I haven't played around with the Windows 7 dialogs yet, but downloaded the Windows® API Code Pack just this morning as I am implementing the Thumbnail Toolbar and Icon Overlay in the application I am working on. It'll probably point you in the right direction.
It's not a programming questions. But this question has been bugging me for awhile.
You know when you start typing in Start Search box in Vista Start Menu, applications are appearing in the list from which you can select them.
My question is how can I add my applications so they appear in that list.
For example: I use many apps from Sysinternals like Process Explorer, AutoRun, .... I would like to launch them by starting typing and as soon as they appear in the list start the application.
if you add them in the startmenu items in your installation then Vista will filter them when your user types there. A simple thing to do is to drag an executable with your right click in your start items list and say create shortcut here.