Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Menu shortcut properties using Shell32.

$
0
0
Hi

I am trying to change properties of a ShortCut in my Windows Menu using following C# code .

Code Snippet

string path = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
            path = path.Replace(Environment.UserName, "All Users");
            Shell32.ShellClass shl = new Shell32.ShellClass();
            Shell32.Folder dir = shl.NameSpace(path);
            if(dir != null)
            {
                Shell32.FolderItem itm = dir.Items().Item("Friends" + ".lnk");
                if(itm != null)
                {
                    Shell32.ShellLinkObject lnk = (Shell32.ShellLinkObject)itm.GetLink;
                    if(lnk != null)
                    {
                        lnk.Arguments = "anu";
                        lnk.Save(null);
                    }
                }
            }



This works perfectly fine when i am logged in as the Windows Admin. But when i attempt to do the same as a limited user, i get access denied error.

Is there any workaround for this issue ??

Thanks n Regards
Anu Viswan

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>