|
-
Nov 22nd, 2000, 09:43 AM
#1
Thread Starter
New Member
I have files on a CD that are hyperlinked. I am using VB as a front end to the .pdf files that I have on that CD. If the CD drive is D: , I may want to:
ShellExecute hwnd, "open", "D:\bookD.pdf", vbNullString, CurDir$, SW_SHOW
but if the CD is Z: , then I may want it to point to:
ShellExecute hwnd, "open", "Z:\bookZ.pdf", vbNullString, CurDir$, SW_SHOW
that way I get the execution of the correct set of hyperlinked files.
You get the picture....
How do I determine what the driveletter is, and then get the (say button in my form) to point to the correct file???
I don't know if I'm making this more difficult than it needs to be, but I don't know how else to do it.
HELP!!??
-
Nov 22nd, 2000, 10:04 AM
#2
Lively Member
there is an API cant remember what its name but it should be at http://www.vbapi.com/
-
Nov 24th, 2000, 09:27 PM
#3
Thread Starter
New Member
Is there another way to go about this??
-
Nov 25th, 2000, 04:26 AM
#4
Fanatic Member
Here is a wrapper function that will get the first CD-Rom Drive letter:
Code:
Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_CDROM = 5
Public Function CDRomDriveLetter() As String
Dim iCt As Integer
Dim sCurDrv As String
Dim lRet As Long
For iCt = Asc("a") To Asc("z")
sCurDrv = Chr(iCt) & ":\"
lRet = GetDriveType(sCurDrv)
If lRet = DRIVE_CDROM Then
CDRomDriveLetter = sCurDrv
iCt = Asc("z")
End If
Next iCt
End Function
The only way I can see this won't work is if the computer being checked has multiple cd-rom drives attached, this function will always return the first cd-rom drive found.
(BTW here is the link klintsovi was thinking of http://www.vbapi.com/ref/g/getdrivetype.html )
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Nov 25th, 2000, 08:17 AM
#5
Addicted Member
Just strip it out of the app.path string!
Code:
Dim strDrive As String
strDrive = Left$(App.Path, 3)
MsgBox ("Hey, my drive letter is: " & strDrive)
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
|