Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

medovid

Where is the EXE - VB6

This topic is 5763 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 a begginer programmer so I never yet had to consider what happens to my program when it is not on my computer. My main problem is - How do I know where the exe, and the files, that are needed for it, located? if I have a ini file, the win api function excpects a full address(c:\bla\blabla\...\info.ini) not just "info.ini" to read or write to the file but I do not know the full address since it is located in the same folder as the exe. Also I know that Vb has a setup wizard that lets you make your own setup program - but is there anything newer/better than that because it does not look good. THANKS

Share this post


Link to post
Share on other sites
Advertisement
Use GetModuleFileName to get the current EXE''s filename:

char sExeFilename[MAX_PATH];
GetModuleFileName(0, // get current module''s path
sExeFilename, MAX_PATH);


Further Explanation
Normally when you run a program, the current directory is set to the directory the EXE is in, so when you try to open a file, such as "info.ini", it looks in the current directory (the EXE''s directory) for info.ini.

Windows'' INI functions, as you have stated, do not look in the EXE''s directory, however. You have to specify the entire path to modify INI files, hence the need for GetModuleFileName to determine the EXE''s directory.

Installation Programs
I use Inno Setup. It''s simple and free! Be sure to download ISTool so that you can create installation scripts graphically.

Share this post


Link to post
Share on other sites
You could also use App.Path. This returns the full path to the current directory that the app is running in as a string.

------------------------------------------------------------
Open your eyes and free your mind
That you may see the subtle wonder
Of the worlds we live in...

Share this post


Link to post
Share on other sites
the package and deployment wizard is a breeze. Take a little time with it and read the steps and you will find it very useful. There are other things like this out there but if you are a beginner I would stick with it. installer scripts are a nightmare.

Share this post


Link to post
Share on other sites

  • 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!