windows 16bit api call 
Author Message
 windows 16bit api call

Hi All,

I am trying to get the following windows api call to work under CW2.003.  I
beleive it should return the amount of free disk space and it is prototyped
as follows:

  MODULE('Windows.DLL')
    GetFreeSpace(WORD),DWORD,Pascal
  END

When I compile I get the following error: Illegal return type or attribute.
 Any help in getting this api to work will be appreciated.

Paul Sonderup
ECI




Sun, 12 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Paul,
I think you could try

MODULE('Windows.DLL')
     GetFreeSpace(WORD),ULONG,PASCAL
                                       ^^^^^^^^^^
END

Your problem is you have probably no definition for DWORD, wich is an
illegal data type from Clarion's point of view, unless you write smth. like

DWORD                   EQUATE(ULONG)

somewhere in your program before the definition of GetFreeSpace.
--
Maxim U. Afanasiev,



Quote:
> Hi All,

> I am trying to get the following windows api call to work under CW2.003.
I
> beleive it should return the amount of free disk space and it is
prototyped
> as follows:

>   MODULE('Windows.DLL')
>     GetFreeSpace(WORD),DWORD,PASCAL
>   END

> When I compile I get the following error: Illegal return type or
attribute.
>  Any help in getting this api to work will be appreciated.

> Paul Sonderup
> ECI





Mon, 13 Dec 1999 03:00:00 GMT  
 windows 16bit api call

The only problem you've got here is that this function will not return
the free disk space,
rather it returns the amount of free memory.

HTH

Quote:

> Paul,
> I think you could try

> MODULE('Windows.DLL')
>      GetFreeSpace(WORD),ULONG,PASCAL
>                                        ^^^^^^^^^^
> END

> Your problem is you have probably no definition for DWORD, wich is an
> illegal data type from Clarion's point of view, unless you write smth.
> like

> DWORD                   EQUATE(ULONG)

> somewhere in your program before the definition of GetFreeSpace.
> --
> Maxim U. Afanasiev,



> > Hi All,

> > I am trying to get the following windows api call to work under
> CW2.003.
> I
> > beleive it should return the amount of free disk space and it is
> prototyped
> > as follows:

> >   MODULE('Windows.DLL')
> >     GetFreeSpace(WORD),DWORD,PASCAL
> >   END

> > When I compile I get the following error: Illegal return type or
> attribute.
> >  Any help in getting this api to work will be appreciated.

> > Paul Sonderup
> > ECI



--
Jim Katz
CTO CycleMart.com
http://www.cyclemart.com Powered By iTZcat

Using Clarion for Windows
Always looking for the simpler solution.



Mon, 13 Dec 1999 03:00:00 GMT  
 windows 16bit api call



Quote:
> The only problem you've got here is that this function will not return
> the free disk space,
> rather it returns the amount of free memory.

Is there a 16 bit windows api call that will return the amount of free disk
space on a drive?

Paul Sonderup
ECI




Mon, 13 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Quote:

> <snip
> Is there a 16 bit windows api call that will return the amount of free
> disk
> space on a drive?

Hi Paul,
The only way to do this that I know of is to use the file manager
extensions for the Win API. As in : FMS_GETDRIVEINFO
This uses a structure( this is from VB):

#include <wfext.h>

typedef struct tagFMS_GETDRIVEINFO { /* fmsgdi */
    DWORD dwTotalSpace;  !! < make this a Ulong
    DWORD dwFreeSpace;  !! < make this a Ulong
    char  szPath[260];   !! These are CStrings
    char  szVolume[14];
    char  szShare[128];

Quote:
} FMS_GETDRIVEINFO, FAR *LPFMS_GETDRIVEINFO;

For more info read up on the File Manager Extensions to the WIN API.

HTH

--
Jim Katz
CTO CycleMart.com
http://www.cyclemart.com Powered By iTZcat

Using Clarion for Windows
Always looking for the simpler solution.



Mon, 13 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Thanks a lot, Jim. I just did not notice _what_ call it was.
--
Maxim U. Afanasiev,



Quote:
> The only problem you've got here is that this function will not return
> the free disk space,
> rather it returns the amount of free memory.

> HTH



Tue, 14 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Here is a function that will work in both 16 and 32-bit modes:

GetDiskFreeSpace(*CSTRING,ULONG,ULONG,ULONG,ULONG),ULONG,PASCAL,RAW,Name('Ge
tDiskFreeSpaceA')

Regs   GROUP,PRE()
WordRegs   GROUP,PRE(WREGS)
AX   USHORT
BX   USHORT
CX   USHORT
DX   USHORT
SI   USHORT
DI   USHORT
CFLAG   USHORT
FLAG   USHORT
   END
ByteRegs   GROUP,PRE(BREGS),OVER(WordRegs)
AL   BYTE
AH   BYTE
BL   BYTE
BH   BYTE
CL   BYTE
CH   BYTE
DL   BYTE
DH   BYTE
   END
SRegs   GROUP,PRE(SREGS)
ES   USHORT
CS   USHORT
SS   USHORT
DS   USHORT
   END
   END

                     MEMBER('CDUTIL.clw')         ! This is a MEMBER module
GetDiskSpace         FUNCTION (DRIVE)             ! Declare Procedure
SecPerCluster        ULONG
BytesPerSec          ULONG
NumFreeCluster       ULONG
TotalClusters        ULONG
Interrupt        USHORT
ReturnVAL        USHORT
IsReady          BYTE
bCluster         LONG
TotalSpace       ULONG
DriveNum         USHORT
  CODE                                            ! Begin processed code
  Omit('***',_WIDTH32_)
   DriveNum = Val(Drive[1]) - 65
   CLEAR(Regs)
   CLEAR(Regs)
   Interrupt = 021H                                ! Int 21h
   BREGS:AH = GetDiskFree                              ! Function Number
for
   BREGS:DL = DriveNum
   ReturnVAL = Int86X(Interrupt,Regs,Regs,SRegs)
   if WREGS:AX <> -1
     TotalSpace = WREGS:CX*WREGS:BX*WREGS:AX
    else
     TotalSpace = WREGS:AX
   .
   Return(TotalSpace)

  ***
  COMPILE('***',_WIDTH32_)

GetDiskFreeSpace(Drive,Address(SecPerCluster),Address(BytesPerSec),Address(N
umFreeCluster),Address(TotalClusters))
    TotalSpace = SecPerCluster*BytesPerSec*NumFreeCluster

    Return(TotalSpace)

  ***



Quote:

> > <snip
> > Is there a 16 bit windows api call that will return the amount of free
> > disk
> > space on a drive?

> Hi Paul,
> The only way to do this that I know of is to use the file manager
> extensions for the Win API. As in : FMS_GETDRIVEINFO
> This uses a structure( this is from VB):

> #include <wfext.h>

> typedef struct tagFMS_GETDRIVEINFO { /* fmsgdi */
>     DWORD dwTotalSpace;  !! < make this a Ulong
>     DWORD dwFreeSpace;  !! < make this a Ulong
>     char  szPath[260];   !! These are CStrings
>     char  szVolume[14];
>     char  szShare[128];
> } FMS_GETDRIVEINFO, FAR *LPFMS_GETDRIVEINFO;

> For more info read up on the File Manager Extensions to the WIN API.

> HTH

> --
> Jim Katz
> CTO CycleMart.com
> http://www.cyclemart.com Powered By iTZcat

> Using Clarion for Windows
> Always looking for the simpler solution.



Tue, 14 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Quote:

>Is there a 16 bit windows api call that will return the amount of free disk
>space on a drive?

        Paul,

        You should have received my e-mail by now.
        I have a DLL that does the job in 16 bits. Anybody
        interested just leave me a note.

Regards
Markku
--------------------------------------
Markku Niskanen
Laatumikro Oy

domain    : laatumikro.inet.fi



Tue, 14 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Hi George,



Quote:
>   ReturnVAL = Int86X(Interrupt,Regs,Regs,SRegs)
>   if WREGS:AX <> -1
>     TotalSpace = WREGS:CX*WREGS:BX*WREGS:AX
>    else
>     TotalSpace = WREGS:AX

I take it that you are using function 36H (didn't find it in the
code).  As far as I know this will not return correct values for
drives that don't use the bios setup in the computer (scsi for
example), but works fine for IDE/floppy drives.  

Best regards,

Arnor Baldvinsson
Allerup Edb
Tel: +45 4675 7122
Fax: +45 4675 7144
Denmark


http://www.icetips.com

Opinions are mine, and mine alone!



Wed, 15 Dec 1999 03:00:00 GMT  
 windows 16bit api call

This should get it for SCSI drives also because it uses a DOS call. The
SCSI driver should return this information back to DOS. Using the int 10
functions you wouldn't get this information.



Quote:
> Hi George,



> >   ReturnVAL = Int86X(Interrupt,Regs,Regs,SRegs)
> >   if WREGS:AX <> -1
> >     TotalSpace = WREGS:CX*WREGS:BX*WREGS:AX
> >    else
> >     TotalSpace = WREGS:AX

> I take it that you are using function 36H (didn't find it in the
> code).  As far as I know this will not return correct values for
> drives that don't use the bios setup in the computer (scsi for
> example), but works fine for IDE/floppy drives.  

> Best regards,

> Arnor Baldvinsson
> Allerup Edb
> Tel: +45 4675 7122
> Fax: +45 4675 7144
> Denmark


> http://www.icetips.com

> Opinions are mine, and mine alone!



Fri, 17 Dec 1999 03:00:00 GMT  
 windows 16bit api call

Hi George,



Quote:
>This should get it for SCSI drives also because it uses a DOS call. The
>SCSI driver should return this information back to DOS. Using the int 10
>functions you wouldn't get this information.

You are right, I confused it with a BIOS call that used exactly the
same parameters, getting the sectors etc. from the bios, which failed
on a SCSI because this info isn't stored in the bios.  Sorry for the
misinformation...

Best regards,

Arnor Baldvinsson
Allerup Edb
Tel: +45 4675 7122
Fax: +45 4675 7144
Denmark


http://www.icetips.com

Opinions are mine, and mine alone!



Fri, 17 Dec 1999 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Windows 16bit C Calling

2. Windows 16bit C Calling 32Bit ASM

3. Calling Windows API functions involving windows?

4. some clear examples for FFI call to a Windows api function in Franz Allegro for Windows

5. Windows API calls and pbcc

6. Windows API calls

7. API-call for scheduling jobs after restart of windows

8. Windows API call GetDeviceCaps. Need help

9. Windows API Calls in a DLL.

10. Windows API Calls Documentation?

11. Windows API call

 

 
Powered by phpBB® Forum Software