What is the wrong?
The LPDWORD return values from GetDiskFreeSpace() are not the same as "double &". A DWORD is an unsigned 4-byte integer. A double is an 8-byte floating-point number.
Secondly, you cannot pass the address of a single int (or double) variable to a DLL in MQL4. You have to pass an array, of which only the first element then gets used.
For example:
#import "kernel32.dll" int GetDiskFreeSpaceA (string as_dir, int & al_sectorspercluster[], int& al_bytespersector[], int& al_freeclusters[], int& al_totalclusters[]); #import void start() { // Does not make a difference, but this is *NOT THE SAME* as "C:"+ CharToStr(92)+ CharToStr(92); string as_dir = "c:\\"; // i.e. the string value C:\ NOT the string value C:\\ // 4 arrays to hold the four LPDWORD return values int rv1[1], rv2[1], rv3[1], rv4[1]; // Call GetDiskFreeSpaceA() int a = GetDiskFreeSpaceA(as_dir, rv1, rv2, rv3, rv4); // For convenience, put each of the return values into its own int variable int al_sectorspercluster = rv1[0]; int al_bytespersector = rv2[0]; int al_freeclusters = rv3[0]; int al_totalclusters = rv4[0]; Alert(a, as_dir, " al_sectorspercluster:", al_sectorspercluster, " al_bytespersector:", al_bytespersector, " al_freeclusters:", al_freeclusters, " al_totalclusters:", al_totalclusters); }
- gchrmt4:or
// Does not make a difference, but this is *NOT THE SAME* as "C:"+ CharToStr(92)+ CharToStr(92); string as_dir = "c:\\"; // i.e. the string value C:\ NOT the string value C:\\
#define BS "\\" // A single back slash "\" string as_dir = "c:"+BS; // i.e. the string value C:\ NOT the string value C:\\
- ttechnik:Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling back and forth trying to read it. Edit the post with formatted code and you might get additional help.
Alert(a, as_dir, " al_sectorspercluster:", al_sectorspercluster, " al_bytespersector:", al_bytespersector, " al_freeclusters:", al_freeclusters, " al_totalclusters:", al_totalclusters);
- gchrmt4:or
- ttechnik:Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling back and forth trying to read it. Edit the post with formatted code and you might get additional help.
THX, My monitor's wide is 30"... :)
The LPDWORD return values from GetDiskFreeSpace() are not the same as "double &". A DWORD is an unsigned 4-byte integer. A double is an 8-byte floating-point number.
Secondly, you cannot pass the address of a single int (or double) variable to a DLL in MQL4. You have to pass an array, of which only the first element then gets used.
For example:
thank you very much for your help!
THX, My monitor's wide is 30"... :)

With the new MT4 (currently beta), you can get free disk space with :
Print(TerminalInfoInteger(TERMINAL_DISK_SPACE));
With the new MT4 (currently beta), you can get free disk space with :
thx
thx
IN the Build 600:
Replace GetDiskFreeSpaceA to GetDiskFreeSpaceW
- ttechnik:Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling back and forth trying to read it. Edit the post with formatted code and you might get additional help.
Alert(a, as_dir, " al_sectorspercluster:", al_sectorspercluster, " al_bytespersector:", al_bytespersector, " al_freeclusters:", al_freeclusters, " al_totalclusters:", al_totalclusters);
Looks fine to me on a 24" monitor, with 5 inches to spare too!
Looks fine to me on a 24" monitor, with 5 inches to spare too!
:) THX

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
What is the wrong?
All value is 0.
THX