|
-
July 2nd, 1999, 06:31 PM
#1
SHGetDiskFreeSpace
Anyone used SHGetDiskFreeSpace and does it work for drives greater than 2 gig under Win98?
Is it still named SHGetDiskFreeSpace in Shell32.dll or does it have another name?
Thanks.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
July 2nd, 1999, 11:38 PM
#2
-
July 3rd, 1999, 01:16 AM
#3
Re: SHGetDiskFreeSpace
Hi Ravi,
Thanks but that isn't what I was looking for. If you look at my previous post about GetFreeDiskSpaceEx, you'll notice that I mentioned that that function call fails under Windows 98 (and Windows 98 SE) so the link you pointed to isn't of any assistance.
It's because of the problems I've run into with GetDiskFreeSpaceEx under Win98 that I've been looking for another method to find the free disk space, and that's why I was looking into SHGetDiskFreeSpace.
Thanks and regards.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
July 3rd, 1999, 04:52 AM
#4
Re: SHGetDiskFreeSpace
i dont think SHGetDiskFreeSpace will solve your problem.
the docs just says it calls GetDiskFreeSpaceEx. i will
cut and paste for you..
SHGetDiskFreeSpace is nearly identical to the GetDiskFreeSpaceEx API. SHGetDiskFreeSpace will load the proper module, obtain the address of GetDiskFreeSpaceEx and then call it. This prevents the caller from having to perform these operations themselves. See the operating system restrictions for GetDiskFreeSpaceEx for more information.
This function is implemented in shell versions 4.71 and later. In order to maintain backward compatibility with previous shell versions, this function should not be used explicitly. Instead, the LoadLibrary and GetProcAddress functions should be used to obtain the function address.
if you find a solution i would like to hear about it.
Regards,
Mark
[email protected]
-
July 3rd, 1999, 12:23 PM
#5
Re: SHGetDiskFreeSpace
Hi Mark
Well I changed the code - previusly I was returning the value that GetDiskFreeSpaceEx returned in the second parameter, my variable nTotalAvailable... but that didn't match the amount that Explorer->Properties returned under Win98 (on NT & 95 it matched)... so I tried using the last parameter returned, my variable nTotalFreeBytes and that mathes. So now I have to go back and check that under the other OS'
Thanks for your input - below is the code I ended up with.
BOOL CTest2Dlg::GetFreeDiskSpace(LPCTSTR pszPath)
{
DWORDLONG dwlFree = 0L;
typedef BOOL (CALLBACK GETFREESPACE) (LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
BOOL bRet = FALSE;
HINSTANCE hInstance = LoadLibrary("KERNEL32.DLL");
if (hInstance) // If the library loaded
{
GETFREESPACE *lpfnDLLProc = NULL;
lpfnDLLProc = (GETFREESPACE*)GetProcAddress(hInstance, "GetDiskFreeSpaceExA");
if (lpfnDLLProc)
m_bSupport = TRUE;
else
m_bSupport = FALSE;
if (lpfnDLLProc) // Got the function
{
ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable;
if ((*lpfnDLLProc)(pszPath, &nTotalAvailable, &nTotalBytes, &nTotalFreeBytes))
{
dwlFree = nTotalFreeBytes.QuadPart;
bRet = TRUE;
}
}
FreeLibrary(hInstance);
}
if (!bRet)
{
ULONG dwSectorsPerCluster;
ULONG dwBytesPerSector;
ULONG dwNumberOfFreeClusters;
ULONG dwTotalNumberOfClusters;
if (GetDiskFreeSpace(pszPath, &dwSectorsPerCluster, &dwBytesPerSector,
&dwNumberOfFreeClusters, &dwTotalNumberOfClusters))
{
dwlFree = dwSectorsPerCluster * dwBytesPerSector * dwNumberOfFreeClusters;
bRet = TRUE;
}
}
m_szFreeSpace = PlaceThouCharsDW((DWORDLONG)dwlFree); // Simple function places commas in value
m_szFreeSpace += " ";
UpdateData(FALSE);
return bRet;
}
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|