Hi there,
I'm having some major problem on a, theoretically, trivial task.
This is my situation: I've written a small program that is meant to edit image files. In the directory of the program there's a 'settings.txt'-file. The problem is, however, that whenever I open an image with this program (via rightclick on the image file, 'open with...' -> my program's exe), the exe is started from another directory than the one it's in (either C:\windows\system32 - why?! - or the file of the image, depending on how I select the exe).
I then said to myself 'OK, no problem, let me just take the registry then to find out where DBPro is installed, this way I can find out where my settings.txt-file is'. So I opened regedit to find where DBP stores the install path, found it and tried to read this value:
dbp$ = get registry$("Dark Basic/Dark Basic Pro", "INSTALL-PATH")
And it totally worked. However, after compiling it again later (definitely without changing this line), it always returned an empty string instead of the DBP-path. I then tried everything, from using the absolute path (HKEY_LOCAL_MACHINE/SOFTWARE/Dark Basic/Dark Basic Pro) to regular expressions, but it never returns anything other than the empty string, no matter if I execute my exe as Admin or whatever.
So, all I really want is
getting access to my settings.txt file that lies on a fixed location on my hard disk. I could, of course, hard code the path into my exe, but actually I was hoping to let others use the program as well without forcing them to use the exact same location for their files.
So, does anyone have an idea how I either convince windows Vista to run the exe in it's own directory (I have _no_ idea why it doesn't do that in the first place, that just seems so stupid and absolutely senseless to me), or how I can read the DBP-Install-path from the registry?
Thanks in advance. Help is greatly appreciated, I'm totally desperate right now...