Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anybody knows how can i get an event which will notify me when Environment.CurrentDirectory has changed? In fact, Enviroment.CurrentDirectory can change while application is running. For example, when some control ask you a path where you want to save a document and it saves it. So i need to be notified about it..because in a program can be a lot of ways to change Enviroment.CurrentDirectory into other's dll.
Posted
Updated 22-Nov-09 22:27pm
v2

1 solution

AFAIK, this will give you the directory where your exe file recides. I don't see that changing while your application is running (unless I am missing something).

However if you want to check if someone has moved the exe to new location while applciation was not running, you can place the location in registry/database/config file. Then at each start up i.e. Load event of very first form, you can check if the value is same and then take action.

 
Share this answer
 

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