Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Kernell32 GetDiskFreeSpace any idea?

Author
Message
Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 17th Oct 2010 21:52
I try to acces to hard disk total space and free space using a kernell32 windows dll.. but i can't .. any help.. plis, plis..
this is the command GetDiskFreeSpace (GetDiskFreeSpaceEx not work)
Thanks..



Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 18th Oct 2010 17:32
here is my code..




Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 19th Oct 2010 00:46
And... this is the context..
Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long



IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Oct 2010 21:15
Take a look at the parameter names: lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters

lp means a pointer in Microsoft-speak - you need to allocate some memory (memblock, bank etc), pass addresses for these parameters, then read the data from memory when done.

You don't need to do anything for lpRootPathName, as strings are already passed as an address.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 20th Oct 2010 19:41
Thanks IanM.. always you have a god response..
but..



thanks i make a investigation.

mmm...
GetDiskFreeSpace not work
GetDiskFreeSpaceA work bu niot well
GetDiskFreeSpaceEx not work


i find.. enhancement pack have this command..



Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 20th Oct 2010 23:29
"GetDiskFreeSpaceExA" works!
but give me bad information..



Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Oct 2010 00:15 Edited at: 22nd Oct 2010 00:18
I did some editing to your posted code and this seems to indeed work as intended;


Hope that helps

Neodelito
18
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 22nd Oct 2010 06:45
thanks..
but,,
not work.. thaks.. i keep searchig ..



Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Oct 2010 12:35 Edited at: 22nd Oct 2010 12:58
Oh sorry, just copied a part of my code, leaving some things in there that doesn't work without the other context.
I'm sure you already figured out these minor changes, but this compiles as-is:


Edit: oh yeah, IanM's utility plugin pack is reuired also, if you don't already have that. Just see his signature a few posts up

This version uses only DBP native functions:


Login to post a reply

Server time is: 2024-03-29 13:35:28
Your offset time is: 2024-03-29 13:35:28