Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

Inspecting the properties of shortcuts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Jackson - 25 Jun 2007 15:30 GMT
Hello,

I've been asked to write a sort of "desktop clean-up" utility.

Requirements are simple: iterate through the shortcuts (*.lnk files) on the
currently logged-on user's desktop, and delete each link whose TargetPath
property no longer exists.

Iterating through the shortcuts on the desktop is easy enough using
Directory.GetFiles(*.lnk)

I found the following article which explains how to inspect the various
properties of a shortcut:
http://www.codeproject.com/useritems/Starter.asp

This uses COMInterop to inspect the shortcuts.

The author of the article says that he doesn't believe a managed solution is
available for this. Is this true?

I don't really have a problem using COMInterop but I guess I'd prefer to use
a managed solution if possible.

Does anyone know if there is one?

Thanks,

DJ
Nicholas Paldino [.NET/C# MVP] - 25 Jun 2007 17:50 GMT
David,

   Well, there isn't a native managed wrapper for it if that is what you
mean, or a managed way to parse the files and get the contents.

   COM interop is as managed as it is going to get.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hello,
>
[quoted text clipped - 24 lines]
>
> DJ
David Jackson - 26 Jun 2007 10:02 GMT
Hi Nicholas,

Thanks for the reply

> Well, there isn't a native managed wrapper for it if that is what you
> mean, or a managed way to parse the files and get the contents.
>
>    COM interop is as managed as it is going to get.

OK.

DJ
G Himangi - 26 Jun 2007 06:51 GMT
Take a look at ShellLink component from ShellObjects at
http://www.ssware.com/shlobj/shlobj.htm

> Hello,
>
[quoted text clipped - 24 lines]
>
> DJ
David Jackson - 26 Jun 2007 10:09 GMT
Hi G,

Thanks for the reply.

> Take a look at ShellLink component from ShellObjects at
> http://www.ssware.com/shlobj/shlobj.htm

That certainly does look like it would do the job, and a whole lot more!

However, as this is very much a "nice-to-have", I don't really think I can
justify the expense, even at $95.

Thanks again.

DJ

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.