Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2004
    Location
    Washington University in St Louis
    Posts
    117
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Simple VB6 Path Question

    Does anyone know how I can detect the location of the binary in a VB6 application?

    Unfortunately, I inherited some bad code (if you look at my past posts, it seems like a common theme at my job) that does some extremely glitchy and bad absolute pathing. The issue is that this is supposed to be a distributable application, and if you install it on a location other than C:, you are screwed!

    So i need to have a way of detecting the location of the executable on start-up every time and then relative path from there.

    Unfortunately, not completely familiar with the quirks of VB and a couple of quick googles didn't find me anything. My search terms might be lacking (4 hours of sleep, not feeling it).

    Any help much appreciated! Thanks in advance!

  • #2
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Well, I didn't know the answer myself either, so I did a quick search on VB's FSO and I found this page: http://www.aivosto.com/visdev/fso.html

    Below is a quick code snippet:
    Code:
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(App.Path)
    That should get you what you need hopefully.

    -Shane

  • Users who have thanked TheShaner for this post:

    obiwanjabroni (08-23-2007)

  • #3
    Regular Coder
    Join Date
    Jun 2004
    Location
    Washington University in St Louis
    Posts
    117
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks a bunch! That definitely did the trick!

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You should be able to just do App.Path to get the current executing location of your program.
    OracleGuy


  •  

    Posting Permissions

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