Where's the program dir?

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
jexd99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

julio011597Commented:
It is in the registry.

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

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ZifNabCommented:
Well, you can use GetDir at the moment your program is started.
0
julio011597Commented:
GetDir procedure returns the current directory; i guess jexd99 needs the "ProgramDir" (e.g. C:\Programs).
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

ronit051397Commented:
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
ZifNabCommented:
Hohoho, just a sugestion, don't shoot me. I julio is right, but what if you're making a program for Win3.11
0
julio011597Commented:
Don't know :) I've never worked in Win3.11.
0
ZifNabCommented:
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
julio011597Commented:
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
ronit051397Commented:
I think, In Win3.11 you should look in one of the windows ini files,if the program was installed properly.
0
ZifNabCommented:
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
ronit051397Commented:
Then, In 16bit you first call the GetWindowsDir.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.