Jump to content
  • Advertisement
Sign in to follow this  
Pengoose

Locating Program Files directory

This topic is 5056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to add some code that will look in a specific folder, inside a users Program Files directory for an installation program. Is there a specific function and/or a registry entry that I can use to locate a users Program Files folders, as some users may use a different drive letter than the standard "C:" drive when installing Windows? Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Why would you look there for an installation program? If you mean an installed program, which program? Any usable program allows you to select the installation directory (when it needs installation), so just checking random places on the HD isn't likely to be very useful.

If you explain what it is that you are really trying to do, there are probably much better ways of doing it.

Share this post


Link to post
Share on other sites
this was a pain to get going, but this seems to work well:


#include <windows.h>
#include <shlobj.h>
#include <stdio.h>

int main()
{
char buffer[256];
SHGetSpecialFolderPath(NULL, buffer, 0x0026, 0);
printf("%s\n", buffer);
return 0;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!