modoran
modoran

Reputation: 13

Insert item to desktop right-click menufrom shell extension

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

Answers (1)

Stefan
Stefan

Reputation: 43575

Register it under HKCR\DesktopBackground\shellex\ContextMenuHandlers

Upvotes: 1

Related Questions