|
Dear Sharan
This is off topic, but I have a problem you may be able to advise me on. I have lost all the columns in Win98 explorer details view, and cannot find how to recover them.
Is it possible you can give me a clue on how to fix this.
Thanks
- Roger -
|
|
|
|
|
Hi i tried to install the dll with regsvr32 and it failed.
This error code was returned: 0x8007007e
Why doesnt it work? Im using WinXP Pro SWE. It that the problem?
That im using a swedish version of WinXP.
Any help would be appraciated.
|
|
|
|
|
Hi Basappa,
I have downloaded the zip file Dirsize.zip but I could not find any application file in that.
Pl. let me know how to install it in my PC?
I am not a guy from programming side. In my computer, there is no application like c, C++, VC, VC++, VB, etc...
Thanks and Regds...
Rajparikh.
|
|
|
|
|
To install it, unzip the DirSize.zip and at the command prompt type
"regsvr32 yourdrive:\path of the dll\dirsize.dll".
Eg. if you unzip the file in C:\Windows then type "regsvr32 c:\windows\dirsize.dll" to register it.
Then in the explorer, change the view to "Details", right click on the column's title bar, then select "Folder size" from the dropdown.
|
|
|
|
|
been looking for this a long time. great extension to explorer!!!
Thanx!
|
|
|
|
|
I was looking for this for a long time too, but from time to time it makes wrong calculations. I hope a new update come up soon.
|
|
|
|
|
How can we sort folders according to their size ?
Now clicking the column header sorts according to string.
Orcun Colak
|
|
|
|
|
Replace the GetItemData with this one:
STDMETHODIMP CColHandler::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
{
USES_CONVERSION;
V_VT(pvarData) = VT_BSTR; //VT_UI8;
DWORD64 dwSize = 0;
TCHAR szTmp[50];
DWORD dwFiles = 0, dwFolders = 0;
DWORD64 size = 0;
if(pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
dwSize = GetFolderSize(OLE2T(pscd->wszFile),&dwFiles,&dwFolders);
// size = dwSize/(1024*1024);
// if(size == 0)
// {
size = dwSize/1024;
if(size == 0)
{
_i64toa(dwSize,szTmp,10);
strcat(szTmp," Bytes");
}
else
{
_i64toa(size,szTmp,10);
strcat(szTmp," KB");
}
// }
// else
// {
// _i64toa(size,szTmp,10);
// strcat(szTmp," MB");
// }
V_BSTR(pvarData) = SysAllocString(T2OLE(szTmp));
}
else
{
V_BSTR(pvarData) = SysAllocString(T2OLE(""));
}
return S_OK;
}
Now the size is shown only in 'Bytes' or 'Kilo Bytes (KB)'.
If the size is to be sorted according to numbers then the units 'Bytes' or 'KB' cannot be displayed. Even the Microsoft displays only in KB and not in MB or GB. Only in property page shows in KB,MB or GB.
Cheers!
-Sharan
|
|
|
|
|
excuse me:
` The way u give may not work correctly. i found that, when using addin dll, explorer sorts files just according to the str_cmp function, but not the size value. so the 1st character has big weight on arranging items. then, 1 K may be the 1st one in the column, but not 9 K or 9,xxx,xxx KB.
~ but ms explorer does work in the order of size value. i need the reason.
regards!
|
|
|
|
|
I would appreciate if you could incorporate this change into the dll version rather than just giving source. I don't know how to build the dll from source
|
|
|
|
|
Replace the GetItemData with this one:
STDMETHODIMP CColHandler::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
{
USES_CONVERSION;
V_VT(pvarData) = VT_BSTR; //VT_UI8;
DWORD64 dwSize = 0;
TCHAR szTmp[50];
DWORD dwFiles = 0, dwFolders = 0;
DWORD64 size = 0;
if(pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
dwSize = GetFolderSize(OLE2T(pscd->wszFile),&dwFiles,&dwFolders);
// size = dwSize/(1024*1024);
// if(size == 0)
// {
size = dwSize/1024;
if(size == 0)
{
_i64toa(dwSize,szTmp,10);
strcat(szTmp," Bytes");
}
else
{
_i64toa(size,szTmp,10);
strcat(szTmp," KB");
}
// }
// else
// {
// _i64toa(size,szTmp,10);
// strcat(szTmp," MB");
// }
V_BSTR(pvarData) = SysAllocString(T2OLE(szTmp));
}
else
{
V_BSTR(pvarData) = SysAllocString(T2OLE(""));
}
return S_OK;
}
Now the size is shown only in 'Bytes' or 'Kilo Bytes (KB)'.
If the size is to be sorted according to numbers then the units 'Bytes' or 'KB' cannot be displayed. Even the Microsoft displays only in KB and not in MB or GB. Only property page shows in KB,MB or GB.
Cheers!
-Sharan
|
|
|
|
|
calculation is wrong if multiple sub-folders are used
|
|
|
|
|
I agree, it seems that the sum is limited to a 32 bit unsigned integer and then the result is a modulo of 4 GBytes.
|
|
|
|
|
Please replace these functions with the existing ones
STDMETHODIMP CColHandler::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
{
USES_CONVERSION;
V_VT(pvarData) = VT_BSTR;
DWORD64 dwSize = 0;
TCHAR szTmp[50];
DWORD dwFiles = 0, dwFolders = 0;
if(pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
DWORD64 size = 0;
dwSize = GetFolderSize(OLE2T(pscd->wszFile),&dwFiles,&dwFolders);
size = dwSize/(1024*1024);
if(size == 0)
{
size = dwSize/1024;
if(size == 0)
{
_i64toa(dwSize,szTmp,10);
strcat(szTmp," Bytes");
}
else
{
_i64toa(size,szTmp,10);
strcat(szTmp," KB");
}
}
else
{
_i64toa(size,szTmp,10);
strcat(szTmp," MB");
}
V_BSTR(pvarData) = SysAllocString(T2OLE(szTmp));
}
else
{
V_BSTR(pvarData) = SysAllocString(T2OLE(""));
}
return S_OK;
}
// This function is the private to this class. It is called with the folder
//path. It returns the size of the folder. This is made recursive to
//calculate the size of the nested folder(s) if any.
DWORD64 CColHandler::GetFolderSize(LPCTSTR szPath, DWORD *dwFiles, DWORD *dwFolders)
{
TCHAR szFileFilter[512];
TCHAR szFilePath[512];
HANDLE hFind = NULL;
WIN32_FIND_DATA fileinfo;
DWORD64 dwSize = 0;
strcpy(szFilePath,szPath);
strcat(szFilePath,"\\");
strcpy(szFileFilter,szFilePath);
strcat(szFileFilter,"*.*");
hFind = FindFirstFile(szFileFilter,&fileinfo);
do
{
if(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (!strcmp(fileinfo.cFileName,".") || !strcmp(fileinfo.cFileName,".."))
{
//Do nothing for "." and ".." folders
}
else
{
TCHAR sztmp[512];
strcpy(sztmp,szFilePath);
strcat(sztmp,fileinfo.cFileName);
dwSize = dwSize + GetFolderSize(sztmp);
if(dwFolders != NULL)
{
++(*dwFolders);
}
}
}
else
{
if(dwFiles != NULL)
{
++(*dwFiles);
}
}
dwSize += fileinfo.nFileSizeLow;
}while(FindNextFile(hFind,&fileinfo));
FindClose(hFind);
return dwSize;
}
Also change the signature of the <b>GetFolderSize </b>function in the Header file <b>'ColHandler.h' </b>.
You can use dwFolders, dwFiles variables. These gives number of folders and the files in the next level folder.
Happy Coding
-Sharan
|
|
|
|
|
Sharan - first, let me say thank you for making this simple, but very useful extension. For the code you mentioned above to fix the subfolder calculation, could you please update the compiled dll for those of us that can't for whatever reason? Thanks.
|
|
|
|
|
I agree with him, can you compile it and upload it? I'm not very used to compile, I'm just a regular user that loves the Folder size tool you develop.
Per example I have some folder with 6 Gigabytes on them and "the folder size" says that they have 550 megs. The dif is pretty huge.
bye
|
|
|
|
|
Could you please upload an updated DLL? This would save me hours.
Thanks
Tim
|
|
|
|
|
This new code does not appear to give an accurate sum of all files and subdirectories. I have a 2.2GB subdirectory, and the directory size only shows 377MB. Has anyone modified the code to work correctly? This is a great idea. I'm anxious to get it to work.
|
|
|
|
|
Thankyou all for the comments, I will try to improve my writing skills. But I DID NOT copy anything, nither code nor the idea. After posting my article I came to know that similar kind of article is already posted.
Cheers!
-Sharan
|
|
|
|
|
|
|
http://www.codeproject.com/useritems/SHDireSizeColumn.asp
Kochise
In Code we trust !
|
|
|
|
|
I marked this article 4 as it still interrest in it... Why downmarking it to 1.68 ? Just because someone else did the same just 1 day before ?
Kochise
In Code we trust !
|
|
|
|
|
Kochise wrote:
Just because someone else did the same just 1 day before ?
It's really obvious why it is getting low ratings: the article is poor. Why is it poor? For all the classic reasons that we all know and love.
|
|
|
|
|
Right, but the other threads were about the fact that someone else did the same job one day before, not about the relative poverty of his article :/
He also had writtent another piece of code, with the same article quality : http://www.codeproject.com/wtl/atllistgrid.asp !
I know if we start to appologize submiters for the low quality of their articles, will soon gotta junk code everywhere. But Hell, why not just reminding him the EXCELLENT Marc Clifton's article : http://www.codeproject.com/scrapbook/whatisagoodarticle.asp
Kochise
In Code we trust !
|
|
|
|
|