Answer the question
In order to leave comments, you need to log in
Type casting for WinAPI functions in Qt
Actually, there is such a code that does not work correctly in Qt Creator:
unsigned __int64 FreeBytesToCaller, TotalBytes, FreeBytes;
????? WinApiLibrary::GetHardDriveInfo(int flag)
{
GetDiskFreeSpaceEx((LPCTSTR)"c:\\", (PULARGE_INTEGER)&FreeBytesToCaller, (PULARGE_INTEGER)&TotalBytes, (PULARGE_INTEGER)&FreeBytes);
switch (flag)
{
case 1:
return FreeBytesToCaller;
break;
case 2:
return TotalBytes;
break;
case 3:
return FreeBytes;
break;
}
}
qDebug() << wl.GetHardDriveInfo(1);
unsigned __int64 i64FreeBytesToCaller,
i64TotalBytes,
i64FreeBytes;
GetDiskFreeSpaceEx ("c:/",
(PULARGE_INTEGER)&i64FreeBytesToCaller,
(PULARGE_INTEGER)&i64TotalBytes,
(PULARGE_INTEGER)&i64FreeBytes);
cout << i64FreeBytes/1024/1024 << "/" << i64TotalBytes/1024/1024 << '\n';
Answer the question
In order to leave comments, you need to log in
long long GetHardDriveInfo(int flag)
{
ULARGE_INTEGER FreeBytesToCaller, TotalBytes, FreeBytes;
GetDiskFreeSpaceEx(TEXT("c:\\"), &FreeBytesToCaller, &TotalBytes, &FreeBytes);
switch (flag)
{
case 1:
return FreeBytesToCaller.QuadPart;
break;
case 2:
return TotalBytes.QuadPart;
break;
case 3:
return FreeBytes.QuadPart;
break;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question