Disk Size & Type (Capacity / Free / Used)

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by scurrier.

Thanks Freak
your code worked for me too

drive.s = "C:\"

Structure Quad
L1.l
L2.l
EndStructure

GetDiskFreeSpaceEx_(@drive, FB.Quad, TB.Quad, TFB.Quad)

TB.Quad\L1>>20
TB.Quad\L2>20
TFB.Quad\L2<<12
FreeMB.l = TFB.Quad\L1 + TFB.Quad\L2

UsedMB.l = TotalMB - FreeMB

MessageRequester("Disk Size","Space Total: "+Str(TotalMB)+" MB"+Chr(13)+"Space Free: "+Str(FreeMB)+" MB"+Chr(13)+"Space Used: "+Str(UsedMB)+" MB",0)
End

thanks again
Sean
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Tested it with GigaBytes and worked fine
with a "100GB" drive:

Code: Select all

drive.s = "C:\"


Structure Quad
  L1.l 
  L2.l
EndStructure 


GetDiskFreeSpaceEx_(drive, FB.Quad, TB.Quad, TFB.Quad)


  TB.Quad\L1>>20 : TB.Quad\L2>20 : TFB.Quad\L2<<12
  FreeGB.f = (TFB.Quad\L1 + TFB.Quad\L2) / 1024


  UsedGB.f = TotalGB - FreeGB


MessageRequester("Disk Size drive "+drive,"Space Total: "+StrF(TotalGB,2)+" GB"+Chr(13)+"Space Free : "+StrF(FreeGB,2)+" GB"+Chr(13)+"Space Used: "+StrF(UsedGB,2)+" GB",0)
End
cya,
...Danilo
(registered PureBasic user)

Edited by - Danilo on 19 April 2002 06:12:29
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.

Hi,
Works on W2000 as well, thanks Freak & everyone else who contributed to this post (Rings/Tranquil/Danilo)...

Ta - N

Hi,
finally, this one works fine. (tested on Win98SE, WinME & WinXP)

Code: Select all

; +++++++++++++ Get Disk Space by Timo Harter ++++++++++++++
  
drive.s = "C:\"
  
Structure Quad
  L1.l  
  L2.l
EndStructure 
  
GetDiskFreeSpaceEx_(@drive, FB.Quad, TB.Quad, TFB.Quad)
  
TB.Quad\L1>>20
TB.Quad\L2>20
TFB.Quad\L2.

That's it, 

Timo



A debugged program is one for which you have not yet found the conditions that make it fail.


Edited by - freak on 18 April 2002  16:09:17
[/quote]
Post Reply