File.GetCreationTime
-
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now); I use this code to cause a demo version to expire after 12 days. We've tested it many times and it works great, but we have two users who are reporting that they got asked to register after two days. Can anyone tell me any reason why the creation time of an app that has never been installed on the PC before, would be out by 10 days ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now); I use this code to cause a demo version to expire after 12 days. We've tested it many times and it works great, but we have two users who are reporting that they got asked to register after two days. Can anyone tell me any reason why the creation time of an app that has never been installed on the PC before, would be out by 10 days ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Stupid question... What does the OS think the current creation date is for the file? It may not be your code! Its possible that something changed this value. Hogan
I don't have access to the client machines to find that out. What would change the value, wouldn't the OS create that value and leave it as it is ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I don't have access to the client machines to find that out. What would change the value, wouldn't the OS create that value and leave it as it is ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian, I'm not sure what would change it, but it is possible via the .NET framework to change the Creation Date for a file or directory. I do a process at work where I have to move files and folders manually and I have to manually reset the file creation data. I'll admit that it is rare that needs to be done, but it is possible and does happen. File.SetCreationTime(); So I wouldn't assume that your code is wrong just yet. Talk to that client first. Hogan
-
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now); I use this code to cause a demo version to expire after 12 days. We've tested it many times and it works great, but we have two users who are reporting that they got asked to register after two days. Can anyone tell me any reason why the creation time of an app that has never been installed on the PC before, would be out by 10 days ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now); I use this code to cause a demo version to expire after 12 days. We've tested it many times and it works great, but we have two users who are reporting that they got asked to register after two days. Can anyone tell me any reason why the creation time of an app that has never been installed on the PC before, would be out by 10 days ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now);
But Christian, is this the best method for checking the demo expiration when creation date can be altered ? I am just wondering.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Christian Graus wrote:
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12); stillHasTime = (date >= DateTime.Now);
But Christian, is this the best method for checking the demo expiration when creation date can be altered ? I am just wondering.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
There's not much you can do. Even totally stupid noob can change their system time, so your best chance is storing a file on a clients machine with some kind of time-mark. Some sorta hidden system file stored somewhere deeeeep containing time-mark acquired from the internets is the best way I can think off right now.