How to find creation date of an exe
-
I want to find the creation date of an exe. I am using the following code. Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer Dim fHandle As Integer fHandle = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0) Using this handle, with some more code we can find the creation date. This is working fine in VB. But not working in VB.net. CreateFile is returning -1 in VB.net. Could anyone of you please tell me why it is not working in VB.net and is there any other way(methods) to find the creation date of an vb.exe file. Thanks in advance,
AR Reddy
-
I want to find the creation date of an exe. I am using the following code. Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer Dim fHandle As Integer fHandle = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0) Using this handle, with some more code we can find the creation date. This is working fine in VB. But not working in VB.net. CreateFile is returning -1 in VB.net. Could anyone of you please tell me why it is not working in VB.net and is there any other way(methods) to find the creation date of an vb.exe file. Thanks in advance,
AR Reddy
Dim file As New System.IO.FileInfo("path to file") Dim creationdate As DateTime = file.CreationTime
That should do it
-
I want to find the creation date of an exe. I am using the following code. Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer Dim fHandle As Integer fHandle = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0) Using this handle, with some more code we can find the creation date. This is working fine in VB. But not working in VB.net. CreateFile is returning -1 in VB.net. Could anyone of you please tell me why it is not working in VB.net and is there any other way(methods) to find the creation date of an vb.exe file. Thanks in advance,
AR Reddy
System.IO.File.GetCreation???(string filename) Look for a method similar to the above in .NET and run it on the specified file.
Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my Blog
-
I want to find the creation date of an exe. I am using the following code. Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer Dim fHandle As Integer fHandle = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0) Using this handle, with some more code we can find the creation date. This is working fine in VB. But not working in VB.net. CreateFile is returning -1 in VB.net. Could anyone of you please tell me why it is not working in VB.net and is there any other way(methods) to find the creation date of an vb.exe file. Thanks in advance,
AR Reddy
Dim objFileInfo As New FileInfo("D:\64.jpg") 'To get the creation, lastaccess, lastwrite time of this file Dim dtCreationDate As DateTime = objFileInfo.CreationTime Dim dtLastAccessTime As DateTime = objFileInfo.LastAccessTime Dim dtLastWriteTime As DateTime = objFileInfo.LastWriteTime Found at: http://www.devasp.net/net/articles/display/215.html[^] Or Dim fileName As String = "C:\MyPath\MyFile.txt" If File.Exists(fileName) Then Label_CreationTime.Text = File.GetCreationTime(fileName).ToString Label_LastAccess.Text = File.GetLastAccessTime(fileName).ToString Label_LastWrite.Text = File.GetLastWriteTime(fileName).ToString End If Found at: http://www.codeproject.com/KB/dotnet/FileTime.aspx[^] If you need anymore help. Let me know.