Google Answers Logo
View Question
 
Q: XP/Windows 2000 Registry Location to Poke for Start Menu Entry ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: XP/Windows 2000 Registry Location to Poke for Start Menu Entry
Category: Computers > Operating Systems
Asked by: mesamike-ga
List Price: $30.00
Posted: 21 May 2003 12:12 PDT
Expires: 20 Jun 2003 12:12 PDT
Question ID: 206909
I am using the Wise Installation software program v4 to create an EXE
to install word processing templates on XP home/prof and Windows 2000.
I need to put an entry on the respective startup menus to launch the
master template. It needs to be for the person logged in.  Where is
the registry location needed to poke?  If I first need to resolve who
is logged in, where is that information located?

Request for Question Clarification by joey-ga on 21 May 2003 12:55 PDT
To clarify, do you mean that you want your templates to be an option
when a user clicks to create a "new" file in Word (in additional to
the Normal.dot blank template?)  If this is the case, the registry
needs no additional entries (it can be done in the file system.)

On the other hand, are you asking to automatically launch Microsoft
Word with a certain template whenever that user logs in to Windows?

(I assume you intend the former, but the "startup menu" and "registry"
questions were raising concerns.)

--Joey

Clarification of Question by mesamike-ga on 21 May 2003 15:28 PDT
Joey, when the user clicks on the Start Menu button, I would like an
option such as "Print-Tag Word Templates" to be listed as one of the
main menu options. When they click on it, it will launch MS word or
wordperfect depending on the extension of .dot or .wpt. This template
will then start the appropriate wp and run the autonew macro. I have
this working on win 95,98, ME but not on these other systems.
I do not want it to be associated with the file/new option as I am
also supporting WordPerfect and it has complications. I used to be
able to stick a link in the file folder "c:\windows\start menu" but
that doesn't work in XP (and I assume 2000). Is this enough info?
Thanks, Mike

Request for Question Clarification by mathtalk-ga on 21 May 2003 15:42 PDT
Hi, mesamike-ga:

Is it desired to install this option _only_ for the current user?  or
would it suffice to install the option (which is in fact a
link/shortcut file) in the Startup menu folder common to all users?

It can be easily done either way.

regards, mathtalk-ga

Clarification of Question by mesamike-ga on 21 May 2003 18:10 PDT
Since most of the people will probably be installing it on their own
machines, it would be ok to have it common to all users. Is there more
of a security issue being on a network and going with the "all users"
approach? If not a big deal then the all users approach would be
acceptable.
Thanks,
Mike
Answer  
Subject: Re: XP/Windows 2000 Registry Location to Poke for Start Menu Entry
Answered By: mathtalk-ga on 22 May 2003 12:19 PDT
Rated:5 out of 5 stars
 
Hi, mesamike-ga:

A difference between the NT-family of Windows operating systems and
those which were based on a multi-tasking DOS (Win95/98/ME) is the
provision for multiple user accounts.

Under Windows NT the individualized user settings were kept in a
directory like:

C:\winnt\profiles\<user name>

while under Windows 2000 and XP the corresponding location is like:

C:\Documents and Settings\<user name>

Fortunately it is not necessary to code for the differences based on
operating systems in the NT-family as all three support the definition
of an "environment variable" called USERPROFILE that provides the
correct path, including the <user name> node for the current user.

A simple way to see this in action is to open a console box (the
equivalent of a DOS command window) and type SET.  This command
displays all the defined environment variables, in particular
USERPROFILE.

To use this environment variable you often only need to supply
"%USERPROFILE%" in place of the path to the "Start Menu" folder.  For
example, a perfectly good console command is:

CD %USERPROFILE%\"Start Menu"

This does not work in 2000/XP from a command line:

DIR %USERPROFILE%\"Start Menu"

because the DIR command cannot deal with the embedded spaces in the
path, but this does:

DIR "%USERPROFILE%\Start Menu"

In general you should be able to supply as a filename a string like:

"%USERPROFILE%\Start Menu\mesa.dot"

to identify a new item for the current user's Start Menu.

You could get at the "shared" portion of the Start Menu (common to all
users) by using the environment variable ALLUSERSPROFILE instead of
USERPROFILE.  This is less conservative and might present some
security administration issues, so I bring it up only for the sake of
rounding out the discussion.

If you look in the HKEY_CURRENT_USER registry entries, you will see
under the Environment node that "temp" directories are located by
using "REG_EXPAND_SZ" data types. To use such registry values, you
need to call ExpandEnvironmentStrings before reading the key value. 
See here:

[Call ExpandEnvironmentStrings Before Reading REG_EXPAND_SZ]
http://msdn.microsoft.com/library/en-us/apcompat/apcompat/call_expandenvironmentstrings_before_reading_reg_expand_sz.asp

This shows us that in some sense the enviroment variable USERPROFILE
is more primitive than the registry entries.  In particular if you are
doing low-level programming (i.e. at the Windows SDK/C++ level), then
one simply needs to pass the string "%USERPROFILE%" into the
ExpandEnvironmentStrings function to obtain the path up to the "Start
Menu" directory.

My guess is that in terms of the Wise Installation package, however,
you don't need this low level manipulation.  Just using the
environment variable's value by referencing "%USERPROFILE%" ought to
be sufficient.  Perhaps we need to clarify how the installer is going
to work; either as an MSI (Windows installer package) or as an
installation script.

regards, mathtalk-ga


Other Links of Interest:

In the .Net framework there's an Environment object with
SpecialFolders attributes that provide the corresponding Paths
programmatically, e.g.

Environment.SpecialFolder.StartMenu

gives you the path of the current user's Start Menu directory.

[Paths for Special Folders for Current User in VB.Net]
http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=515
mesamike-ga rated this answer:5 out of 5 stars
Thanks for the well structured answer. It should allow me to get my task finished.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy