Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. File.GetCreationTime

File.GetCreationTime

Scheduled Pinned Locked Moved C#
c++architecturehelpquestionannouncement
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #1

    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 )

    S O N 3 Replies Last reply
    0
    • C Christian Graus

      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 )

      S Offline
      S Offline
      snorkie
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • S snorkie

        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

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        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 )

        S 1 Reply Last reply
        0
        • C Christian Graus

          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 )

          S Offline
          S Offline
          snorkie
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • C Christian Graus

            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 )

            O Offline
            O Offline
            OR0N
            wrote on last edited by
            #5

            They may have caught a virus joggling with their system time. .Net BCL wraps the standard Win32 routines for I/O so this error shouldn't really be .Net specific.

            1 Reply Last reply
            0
            • C Christian Graus

              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 )

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              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

              O 1 Reply Last reply
              0
              • N N a v a n e e t h

                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

                O Offline
                O Offline
                OR0N
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups