Here is my code, but I think the result is wrong.
#import "Kernel32.dll" int CompareFileTime(string FilePath1, string FilePath2); #import string aa="E:\\Temp\\test1.txt"; string bb="E:\\Temp\\test1.txt"; string cc="E:\\Temp\\test2.txt"; void OnStart() { int res1=-2,res2=-2; res1=kernel32::CompareFileTime(aa,bb); res2=kernel32::CompareFileTime(aa,cc); Print(res1," ",res2); }
CompareFileTime Function
Compares two file times.
LONG WINAPI CompareFileTime( __in const FILETIME* lpFileTime1, __in const FILETIME* lpFileTime2 );
Parameters
lpFileTime1A pointer to a FILETIME structure that specifies the first file time.
lpFileTime2A pointer to a FILETIME structure that specifies the second file time.
and, how to use "kernel32::GetFileSize"? Thanks
- msdn.microsoft.com
CompareFileTime Function
Compares two file times.
Parameters
lpFileTime1A pointer to a FILETIME structure that specifies the first file time.
lpFileTime2A pointer to a FILETIME structure that specifies the second file time.
Thanks, stringo. If I have to use "FindFirstFile" first? Can I use "kernel32::FindFirstFile" in MQL5? If I can, what's the type of WIN32_FIND_DATA in MQL5?
All the our structures are described in the documentation. There is no WIN32_FIND_DATA structure in MQL5.
You can use kernel32::FindFirstFile in MQL5. How to use see MSDN
I find out some example:
https://www.mql5.com/en/articles/1543
https://www.mql5.com/en/articles/1540
- www.mql5.com
All the our structures are described in the documentation. There is no WIN32_FIND_DATA structure in MQL5.
You can use kernel32::FindFirstFile in MQL5. How to use see MSDN
Please test my code, it always return -1. I am sure there are .ex5 files in that folder. What's wrong?
#import "Kernel32.dll" int FindFirstFileA(string FilePath, int& lpFindFileData[]); int FindClose(int hFile); #import string file1="D:\MetaTrader5\MQL5\Experts\*.ex5"; void OnStart() { int win32_DATA[79]; int hFile=kernel32::FindFirstFileA(file1,win32_DATA); Print(hFile); if(hFile>0)FindClose(hFile); }
Why FindFirstFileA? There is ANSI version.
Use unicode version FindFirstFileW
Why FindFirstFileA? There is ANSI version.
Use unicode version FindFirstFileW
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please, how to use "kernel32::CompareFileTime" in MQL5? thanks very much.