Work fine now... a lot of thanks...
charles
:)
Work fine now... a lot of thanks...
charles
Hi Charles Adriano,
I also want to get disk serial number, I have use your code provide but change it to GetVolumeInformationW , but it is not working. Can you share it to me.
//+------------------------------------------------------------------+ //| GetVolumeInformation.mq4 | //+------------------------------------------------------------------+ #property copyright "Copyright © free" #property link "free" #property strict #property show_inputs #import "kernel32.dll" bool GetVolumeInformationW (string lpRootPathName, string lpVolumeNameBuffer, int nVolumeNameSize, int &lpVolumeSerialNumber[], int &lpMaximumComponentLength[], int &lpFileSystemFlags[], string lpFileSystemNameBuffer, int nFileSystemNameSize); #import extern string DriveLetter = "C"; void start() { string sNameDisk = DriveLetter + ":\\"; string sNameBuffer = " "; string sSysNameBuffer = " "; int dwVSNumber[1] = {0}; int dwMCLength[1] = {0}; int dwFileSF[1] = {0}; bool FunctionOk = GetVolumeInformationW(sNameDisk, sNameBuffer, StringLen(sNameBuffer) + 1, dwVSNumber, dwMCLength, dwFileSF, sSysNameBuffer, StringLen(sSysNameBuffer) + 1); if (FunctionOk) Comment("NameBuffer: \'", sNameBuffer,"\'", "\nSysNameBuffer: \'", sSysNameBuffer,"\'", "\nSysNameBuffer: ", sSysNameBuffer, "\nVSNumber = ", dwVSNumber[0], "\nMCLength = ", dwMCLength[0], "\nFileSF = ", dwFileSF[0]); else Comment("GetVolumeInformationW not all the requested information was retrieved!" "\nNameBuffer: \'", sNameBuffer,"\'", "\nSysNameBuffer: \'", sSysNameBuffer,"\'", "\nVSNumber = ", dwVSNumber[0], "\nMCLength = ", dwMCLength[0], "\nFileSF = ", dwFileSF[0]); return; }
Hi Charles Adriano,
I also want to get disk serial number, I have use your code provide but change it to GetVolumeInformationW , but it is not working. Can you share it to me.
Hi, can any one help me
I also ran into this problem. Your information has helped! You just need to increase the length of empty lines:
.........
string sNameBuffer = " ";
string sSysNameBuffer = " ";
long dwVSNumber [1] = {0};
..........
Everything works fine!
Thank you!
//+------------------------------------------------------------------+ //| GetVolumeInformation.mq4 | //+------------------------------------------------------------------+ #property copyright "Copyright © free" #property link "free" #property strict #property show_inputs #import "kernel32.dll" bool GetVolumeInformationW (string lpRootPathName, string lpVolumeNameBuffer, int nVolumeNameSize, long &lpVolumeSerialNumber[], long &lpMaximumComponentLength[], long &lpFileSystemFlags[], string lpFileSystemNameBuffer, int nFileSystemNameSize); #import extern string DriveLetter = "C"; void start() { string sNameDisk = DriveLetter + ":\\"; string sNameBuffer = " "; string sSysNameBuffer = " "; long dwVSNumber[1] = {0}; long dwMCLength[1] = {0}; long dwFileSF[1] = {0}; bool FunctionOk = GetVolumeInformationW(sNameDisk, sNameBuffer, StringLen(sNameBuffer) + 1, dwVSNumber, dwMCLength, dwFileSF, sSysNameBuffer, StringLen(sSysNameBuffer) + 1); if (FunctionOk) Comment("NameBuffer: \'", sNameBuffer,"\'", "\nSysNameBuffer: \'", sSysNameBuffer,"\'", "\nSysNameBuffer: ", sSysNameBuffer, "\nVSNumber = ", dwVSNumber[0], "\nMCLength = ", dwMCLength[0], "\nFileSF = ", dwFileSF[0]); else Comment("GetVolumeInformationW not all the requested information was retrieved!" "\nNameBuffer: \'", sNameBuffer,"\'", "\nSysNameBuffer: \'", sSysNameBuffer,"\'", "\nVSNumber = ", dwVSNumber[0], "\nMCLength = ", dwMCLength[0], "\nFileSF = ", dwFileSF[0]); return; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all...
please tell me what's wrong in this code?
//| GetVolumeInformation.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © free"
#property link "free"
#property strict
#property show_inputs
#import "kernel32.dll"
bool GetVolumeInformationA (string lpRootPathName,
string lpVolumeNameBuffer,
int nVolumeNameSize,
int &lpVolumeSerialNumber[],
int &lpMaximumComponentLength[],
int &lpFileSystemFlags[],
string lpFileSystemNameBuffer,
int nFileSystemNameSize);
#import
extern string DriveLetter = "C";
void start()
{
string sNameDisk = DriveLetter + ":\\";
string sNameBuffer = " ";
string sSysNameBuffer = " ";
int dwVSNumber[1] = {0};
int dwMCLength[1] = {0};
int dwFileSF[1] = {0};
bool FunctionOk = GetVolumeInformationA(sNameDisk,
sNameBuffer,
StringLen(sNameBuffer) + 1,
dwVSNumber,
dwMCLength,
dwFileSF,
sSysNameBuffer,
StringLen(sSysNameBuffer) + 1);
if (FunctionOk)
Comment("NameBuffer: \'", sNameBuffer,"\'",
"\nSysNameBuffer: \'", sSysNameBuffer,"\'",
"\nSysNameBuffer: ", sSysNameBuffer,
"\nVSNumber = ", dwVSNumber[0],
"\nMCLength = ", dwMCLength[0],
"\nFileSF = ", dwFileSF[0]);
else
Comment("GetVolumeInformationA not all the requested information was retrieved!"
"\nNameBuffer: \'", sNameBuffer,"\'",
"\nSysNameBuffer: \'", sSysNameBuffer,"\'",
"\nVSNumber = ", dwVSNumber[0],
"\nMCLength = ", dwMCLength[0],
"\nFileSF = ", dwFileSF[0]);
return;
}
maybe a import definition or call parameters?
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364993%28v=vs.85%29.aspx
I need to get a serial number of Hard Disk, but this function not work.
Any idea?
charles