Solved

GetWindowsDirectory

Posted on 1998-11-04
8
275 Views
Last Modified: 2013-11-20
I am using InstallShield to setup a program and install 2 files needed by the program.  I thought that the best place to put these might be the windows directory.  I know that there is a function that returns the actual directory that Windows resides in.  I have used online help, but have been unsuccessful in utilizing this function correctly.  Could someone help with the syntax?
0
Comment
Question by:mikeljj
8 Comments
 
LVL 2

Expert Comment

by:jrmcg
ID: 1324187
This can be done easily with InstallShield.  If you open your IS installation program and click on the Components tab you will see a list of Components such as Program Files, Shared DLL's, Help Files, etc....  The files that you are installing should be inside one of the Component folders.  Click on the Component folder that you have the files you want to copy to the Windows Directory and in the "property" box in the window on the right, double-click the destination property.  In here you can select the Windows directory, or the Windows System directory, or the Program Files directory, or your Main program target directory, and so on.  Just click the top folder which is the Windows Operating System directory.  This will then be the directory that all of the files in that component folder will be copied to.  If you have other files in the same folder that you do not want copied here then I would suggest making a separate component folder for these files.

This is all using IS 5.1 or higher.  If your version does not work like this then let me know.
All of the code you write for the installation should be done inside InstallShield Scripting.  InstallShield has created its own functions that will handle anything you may need to do, and implements them inside their own 'Script' code files.

Let me know if you need further help, but if you follow the directions above you should have no problems....

J.R.
0
 

Author Comment

by:mikeljj
ID: 1324188
I know how to use InstallShield,  just not the GetWindowsDirectory command with MFC and Visual C++ in my program.
0
 
LVL 6

Accepted Solution

by:
thresher_shark earned 50 total points
ID: 1324189
Answer coming...
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324190
The use of this function is really rather simple, with some elaboration.  First, I will explain the parameters you pass it.  The first parameter you pass it is a buffer, declared something like this:

char path_to_windows_directory[MAX_PATH];

The second parameter is the size of the first parameter in bytes.  The value in this case is MAX_PATH.

Here is an example of the usage of GetWindowsDirectory:

char path_to_windows[MAX_PATH];  // MAX_PATH is a fairly large number to
                                 // ensure that the complete path can fit
                                 // in the variable.  Some users, after all,
                                 // might have windows installed in some
                                 // really long named directory (folder).

GetWindowsDirectory (path_to_windows, MAX_PATH);

That's it!  If you have any additional questions regarding the use of the function, please feel free to ask.  Thanks!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:Answers2000
ID: 1324191
One addition to thresher's comment - a final slash (\) is included if Windows is in a root directory (uncommon but possible) - and not included if Windows isn't

Make sure you allow for this!
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324192
Yes, good point Answers2000.
0
 

Author Comment

by:mikeljj
ID: 1324193
Thank you
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324194
Sure, no problem. :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Execute multiple curl cmds with sleep and send output to file 10 88
sumHeights  challenge 17 65
Fibonacci challenge 11 108
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 232
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now