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

start Shortcut on Desktop

P: n/a
Hi,

I want my appliation to Run a Shortcut on my Desktop. This should be done
regardless the fact if the Shortcut is in the All Users\Desktop or
MyProfile\Desktop and regardless the version of Windows (NT, 2000, XP, 2003,
....) (97 also Cor ;-) ).

Is there a way to Access the Desktop-object with VB.NET?

How should I do this?

Thanks a lot in advance,

Pieter
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Environment.GetFolderPath(Environment.SpecialFolde r.System)
Members
Member name Description
ApplicationData The directory that serves as a common repository for
application-specific data for the current roaming user.
A roaming user works on more than one computer on a network. A roaming
user's profile is kept on a server on the network and is loaded onto a
system when the user logs on.

CommonApplicationData The directory that serves as a common repository
for application-specific data that is used by all users.
CommonProgramFiles The directory for components that are shared across
applications.
Cookies The directory that serves as a common repository for Internet
cookies.
Desktop The logical Desktop rather than the physical file system
location.
DesktopDirectory The directory used to physically store file objects
on the desktop.
Do not confuse this directory with the desktop folder itself, which is
a virtual folder.

Favorites The directory that serves as a common repository for the
user's favorite items.
History The directory that serves as a common repository for Internet
history items.
InternetCache The directory that serves as a common repository for
temporary Internet files.
LocalApplicationData The directory that serves as a common repository
for application-specific data that is used by the current, non-roaming user.
MyComputer The "My Computer" folder.
MyMusic The "My Music" folder.
MyPictures The "My Pictures" folder.
Personal The directory that serves as a common repository for
documents.
ProgramFiles The program files directory.
Programs The directory that contains the user's program groups.
Recent The directory that contains the user's most recently used
documents.
SendTo The directory that contains the Send To menu items.
StartMenu The directory that contains the Start menu items.
Startup The directory that corresponds to the user's Startup program
group.
The system starts these programs whenever a user logs on or starts
Windows NT or later, or starts Windows 98.

System The System directory.
Templates The directory that serves as a common repository for
document templates.

Hope it helps

eric
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:O3**************@tk2msftngp13.phx.gbl...
Hi,

I want my appliation to Run a Shortcut on my Desktop. This should be done
regardless the fact if the Shortcut is in the All Users\Desktop or
MyProfile\Desktop and regardless the version of Windows (NT, 2000, XP, 2003, ...) (97 also Cor ;-) ).

Is there a way to Access the Desktop-object with VB.NET?

How should I do this?

Thanks a lot in advance,

Pieter

Nov 20 '05 #2

P: n/a
Hi Pieter,

You saw the path from Eric for the normal users,
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)

I do not know how to come with the all users, however when you get not a
direct answer, you can maybe try something as this.

dim systemdrivke as string =
Environment.GetFolderPath(....System).substring(0, 2)
dim lastsleske = Enviro....(.....Desktop).lastindexof("\")
dim desktopnamke as string =
Environment.Get...(...Desktop).substring(lastslesk e)
dim alluserpathke as string = systemdrive & "\Documents and Settings\All
Users\" & desktopnamke

(I have used the EricJ convention for datanames)

I typed it in here just as an idea, not checked of course.

And I think this does not work on the special W98 Belgian prerelease I
thought, however it can of course be something extra in that version.

(For the last sentence I wrote of course that complete routine) :-)

Cor
Nov 20 '05 #3

P: n/a
* "DraguVaso" <pi**********@hotmail.com> scripsit:
I want my appliation to Run a Shortcut on my Desktop. This should be done
regardless the fact if the Shortcut is in the All Users\Desktop or
MyProfile\Desktop and regardless the version of Windows (NT, 2000, XP, 2003,
...) (97 also Cor ;-) ).

Is there a way to Access the Desktop-object with VB.NET?


'Environment.GetFolderPath(SpecialFolder.Desktop)' will return the path
of the desktop "folder" for the currently loggedon user. I am not sure
if this will work on Windows NT too, so I suggest to test it before
shipping the application :-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

P: n/a
I like your variable-names :-D

Thanks guys for the help, although it wasn't really exactly what I was
looking for, hehe.
But in my case now I'm able to find it like this:
strDeskTop =
Replace(System.Environment.GetFolderPath(Environme nt.SpecialFolder.CommonApp
licationData), "Application Data", "DeskTop")
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uJ*************@tk2msftngp13.phx.gbl...
Hi Pieter,

You saw the path from Eric for the normal users,
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)

I do not know how to come with the all users, however when you get not a
direct answer, you can maybe try something as this.

dim systemdrivke as string =
Environment.GetFolderPath(....System).substring(0, 2)
dim lastsleske = Enviro....(.....Desktop).lastindexof("\")
dim desktopnamke as string =
Environment.Get...(...Desktop).substring(lastslesk e)
dim alluserpathke as string = systemdrive & "\Documents and Settings\All
Users\" & desktopnamke

(I have used the EricJ convention for datanames)

I typed it in here just as an idea, not checked of course.

And I think this does not work on the special W98 Belgian prerelease I
thought, however it can of course be something extra in that version.

(For the last sentence I wrote of course that complete routine) :-)

Cor

Nov 20 '05 #5

P: n/a
From the File System Right Click Application Folder select Add then Project Output. This is add the Project OutPut in your Application Folder. Now Right Click the Project out Select Create Short Cut. Cut the Short Cut From Application Folder and Paste it USer's Desktop

Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.