start Shortcut on Desktop

D

DraguVaso

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
 
E

EricJ

Environment.GetFolderPath(Environment.SpecialFolder.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
 
C

Cor Ligthert

Hi Pieter,

You saw the path from Eric for the normal users,
Environment.GetFolderPath(Environment.SpecialFolder.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(lastsleske)
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
 
H

Herfried K. Wagner [MVP]

* "DraguVaso said:
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 :).
 
D

DraguVaso

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(Environment.SpecialFolder.CommonApp
licationData), "Application Data", "DeskTop")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top