Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delphi Programming question

Posted on 1997-09-24
6
Medium Priority
?
918 Views
Last Modified: 2008-03-06
could someone give me an exemple of using
getdiskfreespaceex with delphi, I mean with the types declaration and the call .. I tried but I can't get it to run without bugs. I'm using delphi 3 c/S and osr2
it's a function of osr2, it is documented in the c++builder
ms-sdk help, but if u check the delphi units you will see
that it's there ;)
0
Comment
Question by:jeurk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1346125
Hi
This is not answer. I try find getDiskFreeSpaceEx in MS-SDK and in Delphi, but i can't find ? If this exist ? I can find only getDiskFreeSpace.
0
 
LVL 4

Author Comment

by:jeurk
ID: 1346126
Edited text of question
0
 
LVL 4

Author Comment

by:jeurk
ID: 1346127
Adjusted points to 80
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:ronit051397
ID: 1346128
What exactly do you need?
Information about the clusters or information about disk space?
0
 
LVL 4

Author Comment

by:jeurk
ID: 1346129
Some precisions:
I want to get the free disk space available, It already
works with getdiskfreespace, but I want to use getdiskfreespaceEx
Please just show me the right manner to call that functions
with the right parameters, U know, I try to use it but It
seems to me that it does not work as it should, I think
that maybe my parameter do not have the right type, because
the ms-sdk shows c-typed functions and I'm not sure
of my translation.
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 160 total points
ID: 1346130
When I tried GetDiskFreeSpaceEx I got Access Violations.  It turns out that it is desclared incorrectly in Windows.pas.  It does NOT use Integers for the parameters (32 bits), but instead uses 64-bit structures called ULARGE_INTEGER (in C) or TLargeInteger (in Delphi).

Redeclare it as follows in your interface section:
function GetDiskFreeSpaceEx(lpDirectoryName: PChar;
  var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes: TLargeInteger;
  lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;

In your implementation section, put the following:
function GetDiskFreeSpaceEx; external kernel32 name 'GetDiskFreeSpaceExA';

To call it, do the following:
procedure TForm1.GetBytes;
var
  FreeBytes, TotBytes, TotFreeBytes: TLargeInteger;
begin
  GetDiskFreeSpaceEx('C:\', FreeBytes, TotBytes, @TotFreeBytes);
  ShowMessage('Free Bytes (Available to caller) = ' + FloatToStr(FreeBytes.QuadPart));
  ShowMessage('Total Bytes = ' + FloatToStr(TotBytes.QuadPart));
  ShowMessage('Total Free Bytes = ' + FloatToStr(TotFreeBytes.QuadPart));
end;

Hope this works for you.
JB

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question