Add my applications to Vista's Start Search - windows-vista

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.

Related

Programmatically sort folders on Windows 8

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/

Windows 7 taskbar stacking in multiple places

I pinned Notepad2-mod to the taskbar. When I click the pinned shortcut, it opens a new instance but doesn't stack in place. It begins a new stack. Additional clicks will utilize the second stack. This can probably best be explained via screenshot:
The oddest part is it used to stack on the taskbar shortcut if I started it by clicking on it or using WIN+num, but if I started Notepad2-mod by right-clicking on a file and using "open with notepad2-mod" it would stack in a new stack. Now, they all stack in a new stack (not on the taskbar-pinned shortcut).
Both the "open with notepad2-mod" registry shortcut and the taskbar-pinned shortcut run the same executable.
Ultimately, I'd like them all to stack in the same place, on top of the taskbar-pinned icon.
1) What did I do to persuade it to behave like this?
2) How can I convince it to all stack on the pinned icon?
Edit:
I just noticed in the Task Manager that when I double click a .txt file I'm running a version of this binary named Notepad2.exe and when I click on the icon on the Taskbar I'm running a copy of this same binary named notepad.exe. I must have done that to fool Windows 7 into thinking it was using vanilla Notepad. I thought changing this might fix it, but it did not. They still stack on a different portion of the Taskbar. They even respond to keyboard shortcuts like Start Button+Number for the slot where they do actually stack.
Thanks to the this link, this issue is fixed. Go read his site for a better answer than mine, but, in case his site ever goes away, here are the relevant snippets:
Notepad2 windows are now assigned to a custom AppUserModelID, that's why multiple icons may appear if Notepad2.exe is directly pinned to the taskbar. To fix this, open a Notepad2 window first, and then pin it to the taskbar from the Notepad2 taskbar button context menu.
Note that if you have followed the rest of his instructions on the page and set it up to redirect notepad.exe to notepad2.exe, you actually have to start up Notepad2.exe directly, then right click on the taskbar instance and click "Pin to Taskbar".
Now that I did that, all my Notepad2 instances stack in the same place on the taskbar!
Note that the author of Notepad2 says that you have to add code in your application to handle this.
Some reference documentation.
Assuming that your OS is Windows 7
1. Check the settings of your task bar IE. right click the task bar and click properties # the properties menu there is a drop down list it should say "Stack & hide-labels" if not set it to that setting.
If that does not work then you can try dragging the file that will not stack to the regular notepad and pin-it to the list in the stack-able tab.
aside from all of that, when you pin a application to the task bar even if it was edited and saved before it was pinned, it will always open a new instance of the application.
also you can make a simple batch file to start the application
#echo off
rem you will want to set the directory using the DIR command
start "your program's name here"
rem you can use the pause>nul command to check if it worked.
Hope this helps.
I had this problem with Internet Explorer because I had created a short cut and pinned that to the Task Bar. Then all new instances would stack on a separate icon. I unpinned the shortcut, then navigated to the IE executable, right clicked and selected "Pin to Task Bar". After I did that, all new instances stacked on top of the original pinned IE icon.

Register program on windows registry so that it appears on "Uninstall a program" on Control Panel

Let's say I have a simple program: SomeProgram.exe and Uninstaller.exe those programs are in C:\ProgramFiles\MyProgram along with several dll's and resources.
Anyways I have a simple installer that installs several prerequisites to that path. Now my question is how can I register SomeProgram.exe on window registry so that I can have it appear in add or remove programs in control panel. I will like to execute Uninstaller.exe when the user clicks on remove my program. Also I will like to create a folder on windows startup menu so that the user can start the program from there in case he does not want to have a shortcut on the desktop.
All you need to do is to create the registry entries as documented in the second link from "sergmat". This will make the program to appear in the list from Control Panel.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa372105(v=vs.85).aspx

Is there an API in Windows 7 for creating "split menu items"?

I don't know what their official name is, but I mean these things:
Is there an official API for creating those in my own program?
And related question: Did you ever see these "split menu items" used anywhere other than the start menu? Where? This could point at an API.
Glancing at my own start menu, I'm guessing that most are generated the same way "Recent Documents" used to be done. i.e., observing the files that programs open.
As for new APIs, this page might be a good place to start sniffing around: http://msdn.microsoft.com/en-us/library/ee461765%28VS.85%29.aspx
To create tasks like internet explorer etc, use ICustomDestinationList->AddUserTasks(), the recent items should show up for file types you are registered to handle (They are added by the open/save dialog or manually by calling SHAddToRecentDocs())

Replacing the Start Menu

I want to make my own Start Menu replacement and I am trying to figure out what approach to use. There are a number of ways the Start Menu is activated: click on it, hit windows key, hit Ctrl+Esc keys or tab until it gets focus and hit the space or enter key.
I know enough about win32 to do each one of these separately and I could figure it out with Spy++. I'd really like to know if there is an easier way through and I can't find any helpful articles.
I'd like to do this for XP and Vista/Windows 7.
I guess that you would have to inject yourself into the explorer.exe process (There can be more than one, but you want the one that has the "Shell_TrayWnd" window) and subclass the taskbar or one of its children to catch/eat the message that brings up the startmenu and instead, show your own window.
Take a look at http://bitbucket.org/wez/evildesk/src/755606d7935d/gdi.cpp , I think you could start your project by seing what they've done.
You can use WindowBlinds and design your own Start Menu as well.

Resources