Results 1 to 12 of 12

Thread: Retrieving Drive Letter

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Posts
    279

    Retrieving Drive Letter

    Is it possible to retrieve the Drive letter you're program is on?

    Like for example: C:\

    Not the current folder but just the Drive letter.

    Possible?

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Retrieving Drive Letter

    Quote Originally Posted by Tantrum3k
    Is it possible to retrieve the Drive letter you're program is on?

    Like for example: C:\

    Not the current folder but just the Drive letter.

    Possible?

    VB Code:
    1. Left(App.Path,3)
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Posts
    279

    Re: Retrieving Drive Letter

    It possible without using App.Path?

    Or does App.Path work also in a DLL? No EXE...

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Retrieving Drive Letter

    Quote Originally Posted by Tantrum3k
    It possible without using App.Path?

    Or does App.Path work also in a DLL? No EXE...
    I am not exactly sure if it will work in a dll or not?
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Posts
    279

    Re: Retrieving Drive Letter

    I've tried using App.Path and GetCurrentDirectory in my DLL project and when I used them it just exited. Could have been a coincidence, though.

    Any other theories on this?

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Posts
    279

    Re: Retrieving Drive Letter

    Isn't .DLL a library and not an executable?

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Retrieving Drive Letter

    Quote Originally Posted by Tantrum3k
    Isn't .DLL a library and not an executable?
    Yes. However the point Rhino is making is valid; App.Path should work for you in a ActiveX.DLL created in VB.

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Retrieving Drive Letter

    You are confused - DLL stands for "dynamic link library" but it is also an executable file. Difference between dll and standard exe is that dll cannot run on its own so it has to be interfaced (or linked if you will). And I am referring to ActiveX.dll of course created in VB.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Posts
    279

    Re: Retrieving Drive Letter

    You think App.Path would still work with a standard DLL that exports functions in vb6? I'm talking about using an Add-In that makes it possible like vbadvanced for example(which does work because I've used it for months).

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Retrieving Drive Letter

    Quote Originally Posted by Tantrum3k
    You think App.Path would still work with a standard DLL that exports functions in vb6? I'm talking about using an Add-In that makes it possible like vbadvanced for example(which does work because I've used it for months).
    It should, but the only way to find out is do it and see what happens.

  12. #12
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Retrieving Drive Letter

    It depends who calls it. If it is a non-VB program then the global objects (App etc.) won't exist, and COM interfaces most probably won't be referenced (unless it is a C++ COM app or something). That makes it a bit hard.

    If it is a VB program then the global objects will be loaded and so it should work.

    I can't remember the API to find the process path but there is one somewhere so if you find that then use it because it will work much better.

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