Need help getting "Startup" items

L

Locke Nash Cole

I'm making a utility similar to MSConfig, I've found it easy enough to
obtain the startup items from the registry for the current user and local
machine... but what about the Startup folder on the Start Menu?

I've found there are 2 system variables that could help me but.. what is the
proper way to get these locations? And be win95/98/me/nt/2k/xp compatable?

ALLUSERPROFILE=C:\Documents And Settings\All Users
USERPROFILE=C:\Documents And Settings\Current User

But I know you can move your profile and what about roaming profiles?

Also what if I want to list all the users on the machines and their startup
items (via their start menu\startup and registry) then I cant use
CurrentUser to access registry.... hrmmm

Can anyone help?
 
S

Sven Groot

Locke said:
I'm making a utility similar to MSConfig, I've found it easy enough to
obtain the startup items from the registry for the current user and
local machine... but what about the Startup folder on the Start Menu?

I've found there are 2 system variables that could help me but.. what
is the proper way to get these locations? And be win95/98/me/nt/2k/xp
compatable?

ALLUSERPROFILE=C:\Documents And Settings\All Users
USERPROFILE=C:\Documents And Settings\Current User

But I know you can move your profile and what about roaming profiles?

What you need is in the registry. Remember that the Startup folder can also
have a different name in different localised versions of Windows (in the
Dutch version it's called Opstarten), so never hard code these things.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders contains all the info you need (in this case, the Startup key)

You can actually access this in code without directly accessing the
registry. To get the name of the startup folder for instance, use:
Dim startup As String =
Environment.GetFolderPath(Environment.SpecialFolder.Startup)
Also what if I want to list all the users on the machines and their
startup items (via their start menu\startup and registry) then I cant
use CurrentUser to access registry.... hrmmm

You might be able to enumerate the members of HKEY_USERS, but remember that
on WinNT/2k/xp/2003 you might not have access to the registry of all users,
and access to their actual start menu location is even more likely to be
restricted, so don't assume you can do this at all.
 

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