Solved

How to create shortcut a program using vb.net???

Posted on 2011-03-14
10
846 Views
Last Modified: 2012-05-11
hi guys

i must create a shortcut of this link
"g:\program files\ltcr\mgx.exe" /nomutex

Open in new window

using vb.net

help me for this solution

thank you.
0
Comment
Question by:l0o3
  • 5
  • 4
10 Comments
 
LVL 41

Expert Comment

by:graye
ID: 35132520
The easiest way is to use the Windows Shell...  This should get you started in the right direction...

Shell = New IWshRuntimeLibrary.IWshShell_Class
Shortcut = Shell.CreateShortcut(file)
0
 

Author Comment

by:l0o3
ID: 35132643
i dident IWshRuntimeLibrary.IWshShell_Class class

where is this?
0
 
LVL 41

Expert Comment

by:graye
ID: 35133819
My appologies, I was running out the door when I wrote that response.

You need to "add a reference" to your project....  Specifically a "COM Reference" to "Windows Script Host Object Model"

Further documentation can be found here:  http://msdn.microsoft.com/en-us/library/a74hyyw0(v=vs.85).aspx

0
 

Author Comment

by:l0o3
ID: 35135141
graye can u attach the project?
0
 
LVL 41

Expert Comment

by:graye
ID: 35137756
I'm confused... are you asking how to add a reference to your project?   or are you asking how to use the Shortcut class?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:l0o3
ID: 35138125
        Shell = New IWshRuntimeLibrary.IWshShell_Class
        Shortcut = Shell.CreateShortcut("g:\program files\ltcr\mgx.exe /nomutex")

Open in new window



The shortcut pathname must end with .lnk or .url.
0
 
LVL 41

Expert Comment

by:graye
ID: 35139015
Take a look at the documentation on what properties that you can set for a shortcut.  There is a pretty good example there.

http://msdn.microsoft.com/en-us/library/xsy6k3ys(v=vs.85).aspx

The creation of the shortcut is just the begining of the process.  After it's created, you fill in the properties you want and then do a Save operation
0
 

Author Comment

by:l0o3
ID: 35140240
i cant run

can you add project for me?

tnx
0
 
LVL 5

Accepted Solution

by:
MedievalWarrior earned 125 total points
ID: 35140512
0
 

Author Closing Comment

by:l0o3
ID: 35142964
tnx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now