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 / VB.NET / April 2007

Tip: Looking for answers? Try searching our database.

Parse shortcuts (LNK files)?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cross - 21 Apr 2007 11:36 GMT
Is there anyone who knows how to parse a windows shortcut (lnk file) on the
start menu? How hard could it be, it is just a few values, like Target file,
Icon file...
I search for in on Internet for a while, but I did not found anything.

So what I want is the sourse code for a shortcut parser, written in VB.net
if possible (C# would be ok), or at least the specification for how a
shortcut (LNK file) is build, so I can writ one myself.

Thanks in advance
Matthias Tacke - 21 Apr 2007 12:45 GMT
> Is there anyone who knows how to parse a windows shortcut (lnk file) on the
> start menu? How hard could it be, it is just a few values, like Target file,
[quoted text clipped - 4 lines]
> if possible (C# would be ok), or at least the specification for how a
> shortcut (LNK file) is build, so I can writ one myself.

Google is your friend ;-)
<http://www.google.com/search?q=lnk+file+format>
The first result here is:
<http://mediasrv.ns.ac.yu/extra/fileformat/windows/lnk/shortcut.pdf>

Here is a script to create a lnk file on the desktop:
<http://www.knowdotnet.com/articles/createshortcutondesktop.html>

Instead of "Desktop" the Specialfolder is "Startmenu" in the line

CType(WshShell.SpecialFolders.Item("Desktop"), String)

HTH

Signature

Greetings
Matthias

Cross - 21 Apr 2007 13:48 GMT
Thank you really.
I tried with google, but I must have picked the wong search criteria.

>> Is there anyone who knows how to parse a windows shortcut (lnk file) on
>> the start menu? How hard could it be, it is just a few values, like
[quoted text clipped - 18 lines]
>
> HTH
Cor Ligthert [MVP] - 22 Apr 2007 17:16 GMT
I like it forever to show the first and last help I got from Herfried, and
one of the main reasons I am active in this newsgroup.

\\\
AxWebBrowser.Navigate("about:<html><body
onload=javascript:window.external.addFavorite('" + textbox1.Text +
"')></body></html>")
///

You never know how it helps you, I am not so sure about what you are asking.

Cor

> Is there anyone who knows how to parse a windows shortcut (lnk file) on
> the start menu? How hard could it be, it is just a few values, like Target
[quoted text clipped - 6 lines]
>
> Thanks in advance
JR - 23 Apr 2007 06:16 GMT
i do it this way.
in vb or vb.net and higher you must leave the 'wshshell' variable.
the example came from script
the control of your dir exist must be changed into a dirinfo

Sub Make_Start_Snelkoppeling()
 Dim OS, Link, User, fso, folder
 Set WshShell = CreateObject("WScript.Shell")
 strstartup = WshShell.specialfolders("Programs") & "\StartUp"

 Set fso = CreateObject("Scripting.FileSystemObject")
 folder = strstartup
 If Not (fso.FolderExists(folder)) Then
   fso.createfolder (folder)
 End If
 Set OS = CreateObject("WScript.Shell")

'new macros
 Set Link = WshShell.CreateShortCut(strstartup & "\Some name.lnk")
 Link.Description = "Your description"
 Link.Hotkey = "Ctrl+Alt+n"
 Link.iconlocation = "C:\WINNT\system32\moricons.dll, 91"
 Link.targetpath = "C:\WINNT\system32\CMD.EXE"
 Link.windowstyle = 7
 Link.workingDirectory = "C:\"
 Link.Save
end sub

>I like it forever to show the first and last help I got from Herfried, and
>one of the main reasons I am active in this newsgroup.
[quoted text clipped - 20 lines]
>>
>> Thanks in advance
Cor Ligthert [MVP] - 23 Apr 2007 19:36 GMT
Jr,

I think that you will be happy with this more by the time way. It covers in
my idea even more.

http://www.vb-tips.com/dbpages.aspx?ID=1f8f3eaf-27a1-40d7-9e0b-23cab5aa1049

Cor

>i do it this way.
> in vb or vb.net and higher you must leave the 'wshshell' variable.
[quoted text clipped - 48 lines]
>>>
>>> Thanks in advance
Herfried K. Wagner [MVP] - 23 Apr 2007 21:50 GMT
"Cor Ligthert [MVP]" <notmyfirstname@planet.nl> schrieb:
> I think that you will be happy with this more by the time way. It covers
> in my idea even more.
>
> http://www.vb-tips.com/dbpages.aspx?ID=1f8f3eaf-27a1-40d7-9e0b-23cab5aa1049

Is there any reason why backslashes are escaped the C#-style way in the
string containing the path?

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>


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.