Reputation: 13
I've written a windows explorer shell extension using VS2010 and ATL, registered under HKLM\Directory\Background\shellex\ContextMenuHandlers to add my commands under context menu.
All is working as expected, but I want to add a context-menu entry which shows up if and only if user has right-clicked on desktop, like windows 7 defaults "gadgets, personalize, etc".
I've tried this, but does not work (does not match):
if (GetForegroundWindow () == GetDesktopWindow ()) {
// code here
}
Any toughts on how this can be done ?
I've also tried using SHGetFolderPath() with CSIDL_DESKTOPDIRECTORY and do a _tcsicmp(), this works, but does show up even if desktop directory is opened in a normal windows explorer window, which I don't want.
Upvotes: 1
Views: 379
Reputation: 43575
Register it under HKCR\DesktopBackground\shellex\ContextMenuHandlers
Upvotes: 1