Program opens wrong file.

I used Inno to build a setup.exe for a VB6 program to be installed on a Win7 machine. Application has 4 exe's and a collection of auxilliary txt files, and one OCX.

Inno.iss script flags: "ignoreversion" on all except for MSFLEXGRID.OCX which is flagged "restartreplace sharedfile regserver".

The setup.exe generated by Inno was used to install this application on the C drive of a Win7 machine.

Development files are on an external "E" hard drive. There are several versions of the aux files there. The correct ones (listed in the Inno script) successively installed on C drive. I know because I looked at them.

Here is the VB6 code to access one of those aux files:

sFileName = "DataBars.txt"
sFilePath = App.Path & "\" & sFileName
MsgBox sFilePath, vbOKOnly
Open sFilePath For Input As #1

I put that MsgBox there (temporarily) so I could actually see the path:
C:\Program Files (x86)\PoolSandS\DataBars.txt

Now here comes the mystery: When I run this installed app, it opens one of the other DataBars files on the E drive!

If I unplug the USB from the E drive, the program bombs because it cannot find the file it is looking for.

What is going on here? Why is it not opening the file specified in sFilePath? Please help.

I had built this setup.exe with "Advanced", but that was a limited one-time download. It seemed to work fine, but I don't want to spend $300 for it.

If it helps: I took a look at the registry with CCleaner. Got two reports:

Problem: Installer Reference Issue
Data: C:\Program Files (x86)\SDPL\PoolSandS
Registry Key: HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\Folders
User: All users

Problem: Missing MUI Reference
Data: C:\Program Files (x86)\SDPL\PoolSandS.exe
Registry Key: HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache
User: Norma
Norma PosyPhysicistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Chris WatsonSoftware DeveloperCommented:
Could it be something do with transparent file redirection (I forget the actual name for it)? There's a feature of recent versions of Windows where, for compatibility reasons with old applications, if you try to access a file in a protected location, you actually access a file in a different (non-protected, user specific) location.
Chris WatsonSoftware DeveloperCommented:
Norma PosyPhysicistAuthor Commented:
Interesting reading that blog.

Should I elect to have setup install this application somewhere else other than \Program Files (x86)?

If so, any suggestions?
Chris WatsonSoftware DeveloperCommented:
You could install the application in the Program Files (x86) folder, but save the data files which you need to read/write in the user's AppData folder.

Another option would be to install the entire application in the user's AppData folder. I think Google Chrome employs this strategy to install on low-privilege accounts.

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
Norma PosyPhysicistAuthor Commented:
That worked! I created my own C:\SDPL folder. When the installer created by Inno came up, I overwrote the destination folder with this one. Program installed, and ran fine.

Thank you very much. -- Norma
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

From novice to tech pro — start learning today.