14 Replies - 1100 Views - Last Post: 20 February 2018 - 12:23 PM Rate Topic: -----

#1 Tomservo2   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-February 18

Generic Drive Letter query

Posted 14 February 2018 - 03:30 PM

Hi,
When writing a program in VB6 for someone else's computer, will their operating system drive always be referred to as C: Drive?

If that's not a definite, can anyone tell me how to describe a path that will be generic to any Windows computer please?

(I need the program I'm writing to access an external file on an unknown Windows computer, and it would seem to be less complicated to keep the file on the Root)

Thanks for your time
kind regards
Tom

Is This A Good Question/Topic? 0
  • +

Replies To: Generic Drive Letter query

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: Generic Drive Letter query

Posted 14 February 2018 - 03:33 PM

Is this really, honestly, VB6? Out of sheer curiosity, why?
Was This Post Helpful? 0
  • +
  • -

#3 Tomservo2   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-February 18

Re: Generic Drive Letter query

Posted 14 February 2018 - 03:55 PM

View Postmodi123_1, on 14 February 2018 - 03:33 PM, said:

Is this really, honestly, VB6? Out of sheer curiosity, why?


I'm not sure about your question, I'm guessing I'm a bit behind the times!?
I've never had to progress from VB6 as it always catered for my needs, and haven't had the time to learn a new version.
I would like to one day, but I'm worried it may take too long before I could benefit from it.
Would I have to jump straight into the latest version?
kr.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: Generic Drive Letter query

Posted 14 February 2018 - 04:00 PM

Let's put it this way - I am not sure where to even find the old VB6 IDE anymore. Are you certain you are not using VB.NET on Visual Studios 2008 or greater?

Quote

access an external file on an unknown Windows computer

Side question - what external file where?
Was This Post Helpful? 0
  • +
  • -

#5 Tomservo2   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-February 18

Re: Generic Drive Letter query

Posted 14 February 2018 - 04:35 PM

View Postmodi123_1, on 14 February 2018 - 04:00 PM, said:

Let's put it this way - I am not sure where to even find the old VB6 IDE anymore. Are you certain you are not using VB.NET on Visual Studios 2008 or greater?

Quote

access an external file on an unknown Windows computer

Side question - what external file where?


No, it's definitely VB6! (I'm embarrassed typing that now!)

The program I've written has to access an Excel file to save the data and pull data from it as well.
That all works well on my computer, but the path I use in the program is not going to work on someone else's computer if the're not using C drive.

Listen, thank you for your responses, I'll have to just do some trial and error stuff to find out.
And I'll think seriously about updating myself!

(I'm going to bed. it's 11:30pm over here (UK)

Thanks modi123_1
Tom
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: Generic Drive Letter query

Posted 14 February 2018 - 07:32 PM

Odd. In the end - yes, I haven't come across anyone who doesn't have their OS installed on c.
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw   User is offline

  • head thrashing
  • member icon

Reputation: 6667
  • View blog
  • Posts: 27,299
  • Joined: 12-December 12

Re: Generic Drive Letter query

Posted 15 February 2018 - 12:28 AM

I have encountered computers where the default letter was D: rather than C:.

I am doubtful (I could be wrong) that there is a simple property somewhere that would tell you "hey, the default drive is D:". I suspect that you would have to iterate through the drives looking for a clear clue. On my computer, my C: drive has Type "Local Disk".

On the other hand, it may be possible to point to a known folder, Documents or Temp, and extract the full path from it.

As C: will cover 99.9% percent of cases, you could attempt to read something on the C: drive, let it fail; if it fails try the D: drive. This will cover 99.99% percent of cases. For anyone else, it serves them right ;)
Was This Post Helpful? 0
  • +
  • -

#8 Tomservo2   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-February 18

Re: Generic Drive Letter query

Posted 17 February 2018 - 10:26 AM

Thanks for your response andrewsw,
I'll go with 'C' and keep my fingers crossed!
kind regards
Tomservo2

This post has been edited by andrewsw: 17 February 2018 - 01:50 PM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#9 maj3091   User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 2,005
  • Joined: 26-March 09

Re: Generic Drive Letter query

Posted 20 February 2018 - 12:10 AM

I'm a bit late on this one, but maybe this article will help.

It uses an API to get the system drive
Was This Post Helpful? 1
  • +
  • -

#10 andrewsw   User is offline

  • head thrashing
  • member icon

Reputation: 6667
  • View blog
  • Posts: 27,299
  • Joined: 12-December 12

Re: Generic Drive Letter query

Posted 20 February 2018 - 01:47 AM

The answer below that one uses a VB function, environ("SystemDrive"), so it looks like it is possible to make a simple query.
Was This Post Helpful? 0
  • +
  • -

#11 maceysoftware   User is offline

  • Foo
  • member icon

Reputation: 367
  • View blog
  • Posts: 1,569
  • Joined: 07-September 13

Re: Generic Drive Letter query

Posted 20 February 2018 - 02:17 AM

For what is it worth I have come across the local drive being the 'M' drive.
Was This Post Helpful? 0
  • +
  • -

#12 andrewsw   User is offline

  • head thrashing
  • member icon

Reputation: 6667
  • View blog
  • Posts: 27,299
  • Joined: 12-December 12

Re: Generic Drive Letter query

Posted 20 February 2018 - 02:41 AM

That's just silly ;)
Was This Post Helpful? 0
  • +
  • -

#13 maceysoftware   User is offline

  • Foo
  • member icon

Reputation: 367
  • View blog
  • Posts: 1,569
  • Joined: 07-September 13

Re: Generic Drive Letter query

Posted 20 February 2018 - 04:20 AM

That is what I thought, however, it is up to the IT department of the company to decide what their standard build is.
Was This Post Helpful? 0
  • +
  • -

#14 andrewsw   User is offline

  • head thrashing
  • member icon

Reputation: 6667
  • View blog
  • Posts: 27,299
  • Joined: 12-December 12

Re: Generic Drive Letter query

Posted 20 February 2018 - 04:23 AM

"M" for, "Mmmmmm... where's my C drive??!!"
Was This Post Helpful? 0
  • +
  • -

#15 Tomservo2   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-February 18

Re: Generic Drive Letter query

Posted 20 February 2018 - 12:23 PM

View Postmaj3091, on 20 February 2018 - 12:10 AM, said:

I'm a bit late on this one, but maybe this article will help.

It uses an API to get the system drive

Thanks, I'll try experimenting with that.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1