Is there builtin to get C:\Document&Settings\Username\startmenu..P

G

Guest

Hello,

Does VS2005 have anything buildin to retrieve the Directory path for

C:\Documents and Settings\UserName\Start Menu\Programs...

Like an application has Application.StartupPath

Or do I have to hardcode:

Dim strUserID As String = System.Environment.UserName
Dim path As String = "C:\Documents and Settings\strUserID\Start Menu...
 
C

Chris Mullins [MVP]

Rich said:
Does VS2005 have anything buildin to retrieve the Directory path for
C:\Documents and Settings\UserName\Start Menu\Programs...

It's in the Environment Namespace:

DirectoryInfo di =
new
DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Favorites));

MessageBox.Show(di.FullName);
 
R

Rad [Visual C# MVP]

Hello,

Does VS2005 have anything buildin to retrieve the Directory path for

C:\Documents and Settings\UserName\Start Menu\Programs...

Like an application has Application.StartupPath

Or do I have to hardcode:

Dim strUserID As String = System.Environment.UserName
Dim path As String = "C:\Documents and Settings\strUserID\Start Menu...

If it for the current user, the follwing expression will get you their
start menu

Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)

For a named user think you might be forced to build it yourself, but by
first getting the system drive. After that you need a bunch of switch
statement because different Windows Versions store these folders in
different locations e.g. Windows NT and 2000 I think stores user folders in
the winnt folder
 

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