about IStartMenuPinnedList interface under windows8
-
Donnerstag, 17. Mai 2012 11:45
Windows 7: Removes an item from the Start menu pinned list and unpins the item from the taskbar.
<small>Windows 8: Unpins the item from the taskbar but does not remove the item from the Start screen.
what can I do if I want to remove a item from the Start screen.</small>- Bearbeitet Okenjian Donnerstag, 17. Mai 2012 11:45
- Verschoben Mike FengMicrosoft Contingent Staff Freitag, 18. Mai 2012 10:42 (From:.NET Base Class Library)
- Verschoben Rob CaplanMicrosoft Employee Sonntag, 20. Mai 2012 19:32 Desktop app question, not Metro style app question (From:Building Metro style apps with C# or VB )
Alle Antworten
-
Freitag, 18. Mai 2012 10:39
Hi Okenjian,
I have moved this thread to Win8 forum for better support.
Thank you for your understanding and support.
Best regards,
Mike Feng
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
Freitag, 18. Mai 2012 20:08Okenjian - is this for Desktop applications or Metro-style applications?
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.- Bearbeitet Matt SmallMicrosoft Employee Freitag, 18. Mai 2012 20:13
-
Samstag, 19. Mai 2012 03:03
Hi, what's the difference between them?
I just want to remove an item from the Start screen of windows 8.
The following code works well under win7,it removes an item from the Start menu pinned list and unpins the item from the taskbar.
However, under win8 it just Unpins the item from the taskbar but does not remove the item from the Start screen.
void unpinShortcut(LPCWSTR path)
{
HRESULT hr = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
if (SUCCEEDED(hr))
{
IShellItem *pitem;
hr = SHCreateItemFromParsingName(path,
NULL,
IID_PPV_ARGS(&pitem));
//
// Do setup work here to remove the link, including the unpinning
// of the item.
//
if (SUCCEEDED(hr))
{
IStartMenuPinnedList *pStartMenuPinnedList;
hr = CoCreateInstance(CLSID_StartMenuPin,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pStartMenuPinnedList));
if (SUCCEEDED(hr))
{
hr = pStartMenuPinnedList->RemoveFromList(pitem);
pStartMenuPinnedList->Release();
}
pitem->Release();
}
else
wprintf(L"fail: %s\n", path);
}
CoUninitialize();
}under win7, all the pinned items in start menu can be found in "C:\programs\appdata\roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu",
uner win8, the directory <StartMenu> is gone.
-
Sonntag, 20. Mai 2012 19:29
Hi Okenjian,
Windows 8 replaces the Start menu with the Start screen. There are several posts on the Building Windows 8 blog about this that you may want to take a look at.
As the documentation that you quoted points out, IStartMenuPinnedList does not remove tiles from the Start screen on Windows 8, only from the TaskBar. This is expected behavior and there is no good way around it.
Regarding Metro style apps vs. desktop apps: Metro style apps are the new with Windows 8 full screen apps that run isolated from standard desktop apps. Desktop apps are the style of application that continues from older OSes. Since your application ran on Windows 7 we know it is a desktop application. You can find more information about writing Metro style apps in the Dev Center for Metro style apps . You can discuss writing Metro style apps in the Windows Metro style apps Forums (such as this one). Discussion of desktop application development should go in the Windows Desktop Development Forums .
I apologize for the confusion and misrouting you've had to deal with here. Since your question is about desktop application programming I'll forward it to a more appropriate forum and keep an eye open for you in case you need any further elaboration.
--Rob
-
Montag, 21. Mai 2012 01:20
Hi, Rob,
It is Metro style app question!
My question is how to remove an item from the Start screen of win8?
obviously, IStartMenuPinnedList can't reach my goal!
-
Montag, 21. Mai 2012 01:49
Why are you trying to remove an item from the Start screen? What is your scenario and overall goal?
There is no general purpose way to do this: pinning and unpinning is primarily a user preference. As on older OSes, Desktop apps place items on the Start screen by saving shortcuts in the FOLDERID_StartMenu (and related) known folder, so if the specific items you want to remove are there you can delete those. If your goal is to remove items the user has explicitly pinned to the Start screen then that cannot be done programmatically.
You are not writing a Metro style app. You are trying to affect the Start screen from a desktop app.
Metro style apps do not run on Windows 7, cannot call IStartMenuPinnedList (as you may have noticed in the documentation it applies to the desktop only) and cannot affect the system.
--Rob
- Als Antwort markiert Bob_BaoMVP, Moderator Dienstag, 29. Mai 2012 08:08
-
Montag, 21. Mai 2012 11:02
Hi, Rob,
Thank you for answering my question.
After my application is installed, a directory named myapp will be created in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs".
There are six shortcuts under directory myapp, under win8, all the shortcuts will appear in both the start screen and the all apps.
My goal is that, all the six shortcuts appear in the all apps screen, and only three of them(which user will use frequently) appear in the start screen.
Thus, I want to unpin 3 item in the start screen!
-
Mittwoch, 23. Mai 2012 00:37
Hi Okenjian,
I don't believe there is any way to do that: the Start screen will show icons for the shortcuts in the Start Menu folders unless the user unpins them. There is no programmatic way to unpin them.
--Rob
-
Mittwoch, 23. Mai 2012 01:08
what does the OS do, when a user unpin an item from the start screen of win8?
change a file or the registry?
The OS must record which shortcut is pinned and which is not.
if only we can find out the record file!
I think that what we need to do is to find out what is changed when a user unpin an item.
- Bearbeitet Okenjian Mittwoch, 23. Mai 2012 12:40 add detail
-
Donnerstag, 24. Mai 2012 02:03
Mucking around in undocumented registry keys is not supported or recommended and may break your system in unexpected ways. Doing so may appear to work now but have subtle errors which only show up later (per Finagle: at the worst possible time)
--Rob
-
Samstag, 26. Mai 2012 02:02
If you look in the SDK in propkey.h you'll find the System.AppUserModel.NoPinToStartOnInstall property which you can apply to a shortcut to prevent it from being automatically pinned to the Start screen when the application is installed. After that point the pin state is up to the user.
--Rob
- Als Antwort markiert Bob_BaoMVP, Moderator Dienstag, 29. Mai 2012 08:08
-
Freitag, 15. Juni 2012 08:33
We also meet this issue. Because we just want to keep major program on Start menu, minor tools are on desktop.
-
Dienstag, 24. Juli 2012 08:23
Hi Okenjian, you can create the shortcuts you want in:
- C:\ProgramData\Microsoft\Windows\Start Menu\Programs
%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs
And all the ones you don't in:
- c:\users\username\Desktop
%userprofile%\desktop
If you're installing the application with an MSI then of course you'd be using the standard tables which is a lot easier.
Hope this is a bit clearer!
James
-
Donnerstag, 15. November 2012 02:05
Dear Mr. Rob,
I have seen all the discussion about this issue, I also want to ask a question: How to disappear(unpin) the icons like "desktop", "Calendar", "Photo". It seems these programs are not in the folder "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs".

