[fpc-pascal]Win32 API Call

James_Wilson at i2.com James_Wilson at i2.com
Fri Dec 7 17:53:30 CET 2001

Sorry for what's most likely a neophytes question...

I'm trying to call the Win32 API function GetDiskFreeSpaceEx, but when I 
do the compiler complains and I get the following error:  Incompatible type for arg no. 4: Got "pLongint", expected "PLARGEINTEGER"

The 4th argument is the same type as the 2nd and 3rd arguments, which 
according to the API Reference they're supposed to be.

Here's the code:

Program SI;


  BUF_SIZE = 255;

  pLongint = ^longint;
  Buffer   = array [1..BUF_SIZE] of char;

  BytesAvail   : pLongint;
  BytesTotal   : pLongint;
  BytesFree    : pLongint;
  CharBuffer   : ^Buffer;

  new (BytesAvail); new (BytesTotal);
  new (BytesFree);  new (CharBuffer);

  GetDiskFreeSpaceEx (CharBuffer,BytesAvail,BytesTotal,BytesFree);

This is from the Win32 Reference:

BOOL GetDiskFreeSpaceEx
    LPCTSTR lpDirectoryName,                            // pointer to 
directory name on disk of interest 
    PULARGE_INTEGER lpFreeBytesAvailableToCaller,       // pointer to 
variable to receive free bytes on disk available to the caller
    PULARGE_INTEGER lpTotalNumberOfBytes,               // pointer to 
variable to receive number of bytes on disk
    PULARGE_INTEGER lpTotalNumberOfFreeBytes    // pointer to variable to 
receive free bytes on disk

Now, I'll be the first to admit that I'm no Win32 expert, but to me I did 
everything correct (but obviously FPC is smarter then I am :-)

Can anybody point me in the right direction? TIA...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20011207/61ce3980/attachment.html>

More information about the fpc-pascal mailing list