PDA

Click to See Complete Forum and Search --> : access files depending on cd drive letter


jmpatrick
Nov 18th, 2000, 08:55 AM
I am an novice VB user, and am a little stuck on a project I am working on. I am accessing the API to open files on a cd. What I would like to do, is access a different file depending on what the cd drive letter is. I use:

ShellExecute hwnd, "open", "D:\book2.pdf", vbNullString, CurDir$, SW_SHOW

but I would like to access a different file if the drive letter is, say, drive letter E:

any suggestions??

Nov 18th, 2000, 11:31 AM
I think you can just leave it blank and it will open automatically no matter what drive it is.

ShellExecute hwnd, "open", "D:\book2.pdf", vbNullString, "", SW_SHOW

or

ShellExecute hwnd, "open", "D:\book2.pdf", vbNullString, vbNullString, SW_SHOW

jmpatrick
Nov 19th, 2000, 06:28 PM
But what I really am looking for, is a different file opening for the different drive letter. So if the current cd drive is D:, then one file opens, but if it is Z:, then a different file opens.

???????

Nov 19th, 2000, 06:38 PM
A few things: what happens when you leave it blank with a "" or vbNullString?

And second, is the user choosing the file? Because you can do something like:

StrFile$ = "D:\book2.pdf"

StrDir$ = Left(StrFile$, 3)

ShellExecute hwnd, "open", strFile$, vbNullString, strDir$, SW_SHOW

jmpatrick
Nov 21st, 2000, 10:47 AM
This dosen't seem to solve my problem. To be more specific, 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.

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!!??