Solved

GetWindowsDirectory

Posted on 1998-11-04
8
281 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 35
dog bark java program 15 112
fizzArray  challenge 1 96
has77  challenge 9 93
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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 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