Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Where's the program dir?

Posted on 1998-01-10
11
Medium Priority
?
237 Views
Last Modified: 2010-04-04
Hi,

   I want to get the program files directory. There doesn't seem to be a getprogramdir or an api command which retrieves this info (similiar to accessing the windows directory). Should this be retrieved somewhere in the registry, or is there an api command I should be using to retrieve this?
              Thanks
0
Comment
Question by:jexd99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 5

Accepted Solution

by:
julio011597 earned 100 total points
ID: 1356105
It is in the registry.

I.e., on my WinNT4.0 it is in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion:ProgramFilesDir
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356106
Well, you can use GetDir at the moment your program is started.
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1356107
GetDir procedure returns the current directory; i guess jexd99 needs the "ProgramDir" (e.g. C:\Programs).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:ronit051397
ID: 1356108
GetDir is not proper cause, for example, if you activate a shortcut of the program which is stored in another directory, usually in the Desktop directory, then this is the directory you will get and not the correct location of the exe file.So, julio is correct.

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356109
Hohoho, just a sugestion, don't shoot me. I julio is right, but what if you're making a program for Win3.11
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1356110
Don't know :) I've never worked in Win3.11.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356111
Yeah, Win3.11, some customers still use it. Damn difficult to make two versions of your program, win3.11 and 95/NT.
By the way, In the previous comment I meant : I know that julio is right (forgot the KNOW). This for don't getting the wrong idea. See you!
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1356112
I'm not a Windows expert, still guess it's a mess to do this job in Win3.11 because Win3.11 has not the concept of ProgramFilesDir itself; in general, if you plan a Win3.11 program, you should "think" win3.11 in order not to get in troubles.

Anyway, just my opinion.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356113
I think, In Win3.11 you should look in one of the windows ini files,if the program was installed properly.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356114
Hi Ronit, correct. But you still have to know the place of that ini file. And who says that the user has installed windows in the windows\ directory?
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356115
Then, In 16bit you first call the GetWindowsDir.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

722 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