Solved

GetWindowsDirectory

Posted on 1998-11-04
8
274 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

758 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

19 Experts available now in Live!

Get 1:1 Help Now