Jump to content
Sign in to follow this  

Tutorial on DllCall() & DllStructs

Recommended Posts

Hello dear community,

$calldata=DllCall("Kernel32.dll","int","GetDiskFreeSpaceW","wstr","C:\","dword*",$SectorsP erCluster,"dword*",$BytesPerSector,"dword*",$NumberOfFreeClusters,"dword*",$TotalNumberOfClusters)

Would it be correct if I am calling the variables in the DllCall as 'dummys' ?
It seems to me to be because you can fill in any variables and that the variables are only needed because the field shouldn't be empty.

I altered the DllCall in:

$calldata = DllCall("Kernel32.dll","int","GetDiskFreeSpaceW","wstr","C:\","dword*",NULL ,"dword*",NULL,"dword*",NULL,"dword*",NULL)


The result in

_ArrayDisplay($calldata, "Caption")

is the same as the top one.
I have some struggle in my mind - this is why I am asking.

I am right?

Kind regards

Edited by OtenMoten

Share this post

Link to post
Share on other sites

Null is designed for wstr/str and Objects.

I would do it this ways.

#include <Array.au3>
$calldata = DllCall("Kernel32.dll","int","GetDiskFreeSpaceW","wstr","C:\","dword*",0 ,"dword*",0,"dword*",0,"dword*",0)

;you also can do this
Local $tCluster=DllStructCreate("dword value")
$calldata = DllCall("Kernel32.dll","int","GetDiskFreeSpaceW","wstr","C:\","ptr",DllStructGetPtr($tCluster) ,"dword*",NULL,"dword*",NULL,"dword*",NULL)



Share this post

Link to post
Share on other sites

Thanks for this. 

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote


 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...