Nothing is everything.

Friday, January 8, 2010

Get Shortcut Path

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/99249eff-5e8f-4ce8-8fd6-625401c987ea/

private string GetShortcutPath(string shortCutPath)
{
Shell32.Shell shl = new Shell32.ShellClass();
Shell32.Folder dir = shl.NameSpace(Path.GetDirectoryName(shortCutPath));
string linkName = Path.GetFileName(shortCutPath);
Shell32.ShellLinkObject linkObj = (Shell32.ShellLinkObject)dir.Items().Item(linkName).GetLink;
return linkObj.Path;
}

We need to add reference of path ‘dll c:\windows\system32\shell32.dll’ to run the code above.

No comments:

Post a Comment

Followers