Click here to Skip to main content
12,453,873 members (98,873 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB6
Is there a simple way to tell what drive was used to load a program in VB?

My problem is I wrote a program, once installed it needs to check the
drive it was installed FROM. That way I can use that data later on in that program.

Something like E:\install and capture that drive letter for use in the program.
At this point I want the program to run and add information so its being written
to run on a flash drive.

Any suggestion would be a great help...
Posted 27-Feb-13 10:12am
Comments
Sergey Alexandrovich Kryukov 27-Feb-13 16:21pm
   
Why? By your application? this is not a problem at all, isn't it obvious? System-wide? Well, possible, but... OK, you are using VB6! I would suggest to forget it. Any specific reason for VB6? Just to waste your life for nothing?..
—SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It has been more than a decade since I last used VB6. Unfortunately, I don't have a copy that I can use to test my solution.

I believe that the following will retrieve the path to the executing program:
App.Path
From this string, you should be able to extract either the drive letter or the UNC path (if the program is run from a file server).

I found the following on the MSDN web site[^]. It shows how App.Path is used to get the path of the executing program.

The following example demonstrates how to display an image file that is stored in the application's folder by retrieving the path to the executing application.

' Visual Basic 6.0
Picture1.Picture = LoadPicture(App.Path & "\Logo.jpg")
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100