Click here to Skip to main content
15,889,852 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

I have the following scenario...

For the club that I play contract bridge at I also manage the computer setup which is responsible for gathering scores from the score entry boxes and calculating scores at the end of a competition drive.

The program installed at this computer also holds the list of members of the club along with some address information such as email adresses etc.

To be able to send a club email to those people, I wrote a little program that accesses this member list and uses the emailaddresses to send the email. The member list lives inside an access database file (let's say Members.mdb, stored along with the program's installation folder under "Program Files").

Now comes the problem... Running this email program under Windows XP is not an issue at all. It opens the database, fetches the emailaddresses and send the emails. Recently, There was an upgrade to Windows 7. The score program runs like a breeze, but suddenly, the email sender program does not find the Members.mdb file anymore. THis turns out to be a feature called "File Virtualization", since the file still exists, but is placed in a different location (AppData....VirtualStore...Program Files...etc) This folder is however user specific, so should not be hardcoded ofcourse.

The question is: Is there a (standardized) way to access files that are supposed to be in the protected (Program Files) area, but were actually stored in their virtual counterpart folders under AppData? My selfwritten program goes to the actual Program Files folder, while the calculation program stores the file in the "virtualized" location.

Any help would be appreciated!

Regards, perry
Posted

Are you looking for Environment.GetFolderPath[^]?

Regards
Espen Harlinn
 
Share this answer
 
Comments
Nish Nishant 12-Apr-11 17:50pm    
Good suggestion, voted 5.
Espen Harlinn 12-Apr-11 17:58pm    
Thank you, Nishant!
Sergey Alexandrovich Kryukov 12-Apr-11 18:04pm    
That simple suggestion is the most adequate, my 5.
--SA
Espen Harlinn 12-Apr-11 18:09pm    
Thanks SAKryukov!
Perry Bruins 13-Apr-11 0:42am    
I will have look at this one, if it works for my, I let you know and vote it 5. Thanks!
One hack-fix would be to run the old Score-app with UAC elevation - which means it will be able to read/write to the Program Files folder (which is what your app reads from).

[Edit]
--------

Follow-up to your comment.

Here your program is working correctly. It's the old program that is not. If you want identical behavior to the old program, compile your app as 32 bit and run it without UAC elevation and it will encounter virtualization too (like the older app).
 
Share this answer
 
v2
Comments
Espen Harlinn 12-Apr-11 17:58pm    
Good point, 5ed!
Perry Bruins 13-Apr-11 0:41am    
This is not what I want, I thought of this solution myself too. What I would like is that my program understands what to do when a situation like this arises, that is, work with UAC and deal with the situation at hand. Thanks for the suggestion though.
Nish Nishant 13-Apr-11 9:02am    
Here your program is working correctly. It's the old program that is not.

If you want identical behavior to the old program, compile your app as 32 bit and run it without UAC elevation and it will encounter virtualization too (like the older app).
Perry Bruins 13-Apr-11 12:58pm    
I'll go with this one since I do not see any alternatives at this moment. THanks for all your thoughts though!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900