Results 1 to 5 of 5

Thread: access files depending on cd drive letter

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    12
    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??

  2. #2
    Guest
    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


  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    12
    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.

    ???????

  4. #4
    Guest
    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:

    Code:
    StrFile$ = "D:\book2.pdf"
    
    StrDir$ = Left(StrFile$, 3)
    
    ShellExecute hwnd, "open", strFile$, vbNullString, strDir$, SW_SHOW

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    12
    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!!??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width