|
-
May 16th, 2008, 01:52 PM
#1
Thread Starter
Junior Member
[RESOLVED] Detect where it's running from....
I've got a little application that plays videos/mp3's. I want to place the application and associated avi's/mp3's on a DVD and play everything from the
dvd. How do I determine if the dvd is loaded in the D:, E:, or F: drive?
In other words the user loads the DVD into a drive, clicks on an executable, and my program knows which drive the DVD is in.
Thanks for everyones help!
doug
-
May 16th, 2008, 02:02 PM
#2
Hyperactive Member
Re: Detect where it's running from....
What does that actually mean?
Do you want to find out what is the drive name for the user's optical disk, or what?
-
May 16th, 2008, 02:17 PM
#3
Thread Starter
Junior Member
Re: Detect where it's running from....
No, just the drive letter. My work computer has several DVD drives, some people have a CD & DVD drive. So if the program is loaded into my E: drive,
the application will know that the required avi's/mp3 are in the E: drive.
Same thing if it's loaded into the D: drive or the F: drive - I just don't know
how to code "if this application is executed from drive d: then avi's/mp3's are
also on drive d:....
-
May 16th, 2008, 04:07 PM
#4
Thread Starter
Junior Member
Re: Detect where it's running from....
found this little bit of code after a couple of hours of searching.
Worked like a charm!!!!!
If Right$(App.Path, 1) = "\" Then
Target = App.Path & "\demo.avi"
Else '
Target = App.Path & "\demo.avi"
End If
-
May 17th, 2008, 05:21 AM
#5
Re: [RESOLVED] Detect where it's running from....
You do realize that both cases in the If statement amount to the same thing?
Perhaps you were looking for this
vb Code:
If Right$(App.Path, 1) = "\" Then Target = App.Path & "demo.avi" Else ' Target = App.Path & "\demo.avi" End If
-
May 17th, 2008, 05:27 AM
#6
Re: [RESOLVED] Detect where it's running from....
But I prefer the code:
vb Code:
Option Explicit Public AppPath as String Private Sub Main() AppPath = App.Path if Right$(AppPath, 1) <> "\" then AppPath = AppPath & "\" End Sub
In this way you just use AppPath everywhere you would normally use App.Path and you don't have to code all the extra lines of code each time... The all you would need to do is:
vb Code:
Target = AppPath & "demo.avi"
-
May 17th, 2008, 12:09 PM
#7
Thread Starter
Junior Member
Re: [RESOLVED] Detect where it's running from....
Excellent, I'll try the other way Monday. I'm ashamed to admit I don't know what the Right$ does....
-
May 17th, 2008, 01:18 PM
#8
Re: [RESOLVED] Detect where it's running from....
That's where DOCUMENTATION comes in, but you do have to read it...
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
|