Page 1 of 2

Get drive name on Win 10?

Posted: Tue Jul 19, 2016 11:40 am
by Dude
I've been using the following code perfectly for years with Windows XP and 7, but I just found out that it doesn't return a disk drive volume name for Windows 10 (based on a screenshot I saw of my app, not from personal experience). Can someone with Windows 10 please confirm? Thank you.

Code: Select all

d$="C:\"

drivename$=Space(999)
driveserial$=Space(999)
drivefs$=Space(999)

GetVolumeInformation_(d$,@drivename$,990,@serial,0,0,@drivefs$,990)

s$=Hex(serial,#PB_Long) : driveserial$=Left(s$,4)+"-"+Right(s$,4)

Debug drivename$ ; Shows empty string on Windows 10. :(
Debug driveserial$
Debug drivefs$

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 11:49 am
by Thunder93
Confirmed.

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 11:51 am
by Dude
Dammit. :cry: Thanks.

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 11:52 am
by Thunder93
Use

Code: Select all

..

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 11:56 am
by Dude
Thanks Thunder93! :D

[Edit] I seriously think I'll have to bite the bullet and upgrade to Win 10 before July 27. It'll make bug-testing easier too because a Win XP ISO is way smaller in size than Win 10, for VirtualBox. :)

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:00 pm
by Thunder93
Nope didn't work. hmmmm

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:01 pm
by Dude
Thunder93 wrote:Nope didn't work. hmmmm
Huh? Oh crap. I might start the Win 10 upgrade tonight then...

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:05 pm
by Thunder93
They work. Reason why it's blank, not everyone has their drives labelled so it becomes ' Local Disk (?:) ' in File Explorer. :)

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:08 pm
by Dude
So my original code works too?

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:09 pm
by Thunder93
Yes.

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:16 pm
by Dude
Thunder93 wrote:Yes.
Again: Thanks Thunder93! :D

BTW, I tested it with an unlabelled drive and you're right. Thanks for helping me with this. :)

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:22 pm
by Thunder93
No problem. :)

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:25 pm
by Dude
And thanks for saving me from upgrading to Windows 10. :twisted:

Re: Get drive name on Win 10?

Posted: Tue Jul 19, 2016 12:35 pm
by Thunder93
I don't know if I actually done you good service there... :twisted: :lol:
Dude wrote:And thanks for saving me from upgrading to Windows 10. :twisted:

Re: Get drive name on Win 10?

Posted: Fri Jun 09, 2017 2:31 pm
by davido
@Dude,
I wanted to find the drive name on Windows 10. Unfortunately I hadn't got a clue. :)
Luckily I managed to find this thread.
Thank you very much for posting the question and also thanks to Thunder93 for the tip. :D