By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

Get location stored in a .lnk file?

P: 1
Hi, does anyone know how to get the location stored in a .lnk file? I have tried to open one in Notepad and a garbled mess came up. I've found some code but it was for VB6 which I do not have, I only have VB 2005 Express. The conversion failed. If anyone is interested, here it is:
Expand|Select|Wrap|Line Numbers
  1. Function StoredLinkPath(LnkPicPath as string) as string
  2. Dim shl as Shell
  3. Dim file as FolderItem
  4. Dim fld as Folder
  5. Dim lnk as ShellLinkObject
  6. Dim i as Long
  7. Dim Check as string
  8. Dim LnkFileName as string
  9.  
  10. 'seperate path from filename
  11. Check = "?"
  12. i = 0
  13. Do While Check <> "\"
  14. i = i + 1
  15. Check = mid(LnkPicPath, len(LnkPicPath) - i, 1)
  16. Loop
  17. LnkFileName = Right(LnkPicPath, i)
  18. LnkPicPath = Left(LnkPicPath, len(LnkPicPath) - (i + 1))
  19.  
  20. set shl = new Shell
  21. set fld = shl.NameSpace(LnkPicPath)
  22. set file = fld.Items.Item(LnkFileName)
  23. set lnk = file.GetLink
  24. StoredLinkPath = lnk.Path
  25.  
  26. End Function
Sep 22 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.