Home
|
Tutorial
|
Articles
|
Forum
|
Interview Question
|
Code Snippets
|
News
|
Fun Zone
|
Poll
|
Web Links
|
Certification
|
Search
Welcome :
Guest
Sign In
Register
Win Surprise Gifts!!!
Congratulations!!!
Top 5 Contributors of the Month
Jean Paul
satyapriyanayak
Narayanan
Karthikeyan Anbarasan
JQuery Developer
Home
>>
Forum
>>
VB.Net
>>
Post New Question
Subscribe to Forum
How to create shortcut icon in vb.net
Posted By:
Mahesh
Posted Date:
June 21, 2012
Points:
5
Category :
VB.Net
How to create shortcut icon for an exe through code in vb.net
Responses
Author:
Mahesh
Company URL:
http://www.dotnetspark.com
Posted Date: June 21, 2012 Points: 20
oWScriptShell = CreateObject("WScript.Shell")
'Read desktop path using WshSpecialFolders object
sStartMenuPath = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)
If Not String.IsNullOrEmpty(oTaskStruct.StartMenuDirectoryPath) Then
sFolders = MenuDirectoryPath.Split("\")
sFolderPath = sStartMenuPath
For Each sFolder As String In sFolders
sFolderPath = Path.Combine(sFolderPath, sFolder)
If Not Directory.Exists(sFolderPath) Then
Directory.CreateDirectory(sFolderPath)
End If
Next
End If
' Create a shortcut object on the desktop
oShortcut = oWScriptShell.CreateShortcut(Path.Combine(Path.Combine(sStartMenuPath, MenuDirectoryPath), LinkName & ".lnk"))
' Set shortcut object properties and save it
oShortcut.TargetPath = oWScriptShell.ExpandEnvironmentStrings(Path.Combine(ShortcutIconExePath, ShortcutIconExeName))
oShortcut.WorkingDirectory = oWScriptShell.ExpandEnvironmentStrings(ShortcutIconExePath)
oShortcut.WindowStyle = 4
'Use this next line to assign a icon other then the default icon for the exe
'MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("path to a file with an embeded icon", icon index number)
'Save the shortcut
oShortcut.Save()
Post Reply
You must
Sign In
To post reply
Related Questions Related Questions
How to create a control in windows application also how could add in the Tool box itself
How to create .exe file
how can create Session
How to create xml on fly
Is it possible to create exe file in asp.net
Latest Forum Questions From The Same Category
Option Explicit vs Option Inter in VB.net
List info of all Mobile devices & Select COM Port for a device
exception while iterating through the records
display checked checkboxes values in to asp.net gridview
Deployment Error
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Here
Quick Links For Forum Categories:
ASP.Net
Windows Application
.NET Framework
C#
VB.Net
ADO.Net
Sql Server
SharePoint
OOPs
Silverlight
IIS
JQuery
JavaScript/VBScript
Biztalk
WPF
Patten/Practices
WCF
Others
www.DotNetSpark.com
UnAnswered
All
Hall of Fame
Twitter
Terms of Service
Privacy Policy
Contact Us
Archives
Tell A Friend