|
-
Jul 31st, 2003, 10:00 AM
#1
Thread Starter
Lively Member
Automatically detection of install-directory
I am making a program with some statistics. One of them show you the last time you accessed the program. This is my code:
___________________________________________
Dim FileSystemObject, FileObject As Object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set FileObject = FileSystemObject.GetFile("C:\Program files\program.exe")
Set FileSystemObject = CreateObject
Text1.Text = vbCrLf & "Last accessed: " & _
FileObject.DateLastAccessed & vbCrLf
_____________________________________________
The thing really, is that I have no guarantee for that the user will put the file in this directory. How do I make the program find the directory itself?
Thank you!
-
Jul 31st, 2003, 10:27 AM
#2
Re: Automatically detection of install-directory
Originally posted by Mutuz
I am making a program with some statistics. One of them show you the last time you accessed the program. This is my code:
___________________________________________
Dim FileSystemObject, FileObject As Object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set FileObject = FileSystemObject.GetFile("C:\Program files\program.exe")
Set FileSystemObject = CreateObject
Text1.Text = vbCrLf & "Last accessed: " & _
FileObject.DateLastAccessed & vbCrLf
_____________________________________________
The thing really, is that I have no guarantee for that the user will put the file in this directory. How do I make the program find the directory itself?
Thank you!
use app.path
that will return the directory the exe is located in... but that only works in the exe itself... is this how you are doing it? because if it is.. then wouldn't the return value always be that day since they need to open the program to view the stat?
-
Jul 31st, 2003, 10:37 AM
#3
Thread Starter
Lively Member
I get an error message, saying: "Run-time error '429': ActiveX component can`t create object."
-
Jul 31st, 2003, 12:43 PM
#4
Originally posted by Mutuz
I get an error message, saying: "Run-time error '429': ActiveX component can`t create object."
post the code..
-
Jul 31st, 2003, 01:26 PM
#5
As kleinma suggested use App.Path. Here is how it should look
Set FileObject = FileSystemObject.GetFile(App.Path & "\program.exe")
-
Jul 31st, 2003, 01:38 PM
#6
what i don't get is... the value will always be the date/time that you opened the exe... so i don't understand the point i guess..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|