Jump to content
  • Advertisement
Sign in to follow this  
Boltimus

Getting a path from the user

This topic is 4794 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'm writing my own installation program and the quick question I have is, how do I get the directory that the user wants to install the program in? I tried using GetOpenFileName, hoping that the user could simply select a folder and then press open, but all that does is open the folder. Any ideas? Thx!

Share this post


Link to post
Share on other sites
Advertisement
Hi, Boltimus!
I'm sure that if you give us more information about your problem someone will help you.
You haven't said what programming language and IDE you actually use (Delphi has some interesting shortcuts to do what you want), or the target operating systems (yes, there's some differences between them that installers must handle).

Goodbye!

PS.: NSIS is my choice for installers. Free and very easy to masterize...

Share this post


Link to post
Share on other sites
Sorry about that, I'm using VS.net and windows XP in C++. Im trying to get the user information via the common dialog box (open box). I am currently using my own dialogproc to handle all messages form the open box, however I'm stuck. What I'm thinking about right now is changing the text in the help button to select and then I can detect when the help button is pressed. But now I cant figure out how to hide the "open" button.

thx


Share this post


Link to post
Share on other sites
SHBrowseForFolder is what he asked for, but what he really wants is to study the Microsoft Installer technology. PLEASE REFRAIN FROM MAKING YOUR OWN INSTALLER. It is not good from a security standpoint (installers require elevated privledges that games shouldn't require) and it is a waste from a software engineering stand point (it has been done 1000 times before).

VS.net includes simple tools to produce MSI files. Use them.

Share this post


Link to post
Share on other sites
Thx for the help everyone! I was able to do this to get the entire path:

SHGetPathFromIDList(SHBrowseForFolder(&bif), szFile);

I understand what you're saying SnprBoB86, I just wanted to try it at least once for myself, before using other software...

Share this post


Link to post
Share on other sites
Quote:
Original post by SnprBoB86
SHBrowseForFolder is what he asked for, but what he really wants is to study the Microsoft Installer technology. PLEASE REFRAIN FROM MAKING YOUR OWN INSTALLER. It is not good from a security standpoint (installers require elevated privledges that games shouldn't require) and it is a waste from a software engineering stand point (it has been done 1000 times before).

Bah. If a game requires anything more complicated than xcopy then it's broken.

Share this post


Link to post
Share on other sites
Quote:
Original post by Boltimus
Thx for the help everyone! I was able to do this to get the entire path:

SHGetPathFromIDList(SHBrowseForFolder(&bif), szFile);

I understand what you're saying SnprBoB86, I just wanted to try it at least once for myself, before using other software...


This is not actually a good way to do things, because it leaks memory. You should instead use something like this:

LPITEMIDLIST lpIDList = SHBrowseForFolder(&bif);
if(lpIDList != NULL)
{
SHGetPathFromIDList(lpIDList, szFile);
IMalloc* pMalloc;
SHGetMalloc(&pMalloc);
pMalloc->Free(lpIDList);
pMalloc->Release();

// now do stuff with the path name
}

Share this post


Link to post
Share on other sites
Quote:
I understand what you're saying SnprBoB86, I just wanted to try it at least once for myself, before using other software...


I understand your desire to try it on your own, but this is one of those situations where you really should forfeit your curiosity in favor of practicality.

Feel free to build an installer, but do not distribute any software with it. The world does not need yet another installer technology. MSI is the Microsoft recommended method for building installers and they are trying to discourage developers from choosing installer platforms that are not based on MSI technologies. The reason for this is that MSI installers are not really programs, they are databases of instructions. As such, they can be easily manipulated and potentially sand boxed. I could, for example, create a simple installer that copies the game files into the install directory and then creates some start menu shortcuts for the current user. Then, another user could receive that MSI and very very easily reconfigure it to install the shortcuts for all users. Additionally, network admins can publish MSI files to multiple computers for automatic installation. Anon Mike makes it clear that he doesn't even believe in installers at all. And I want to agree with him, if it wasn't for the technology un-savyy. I wish Windows application installation worked like Mac OSX :-)

You are best spending your time working on your game. Windows installers are pretty much a solved problem (except for the fact that everyone keeps trying 2 reinvent them).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!