 |
|
|
 |
|
 |
I test on 2TB Virtual Disk,it simulate a 2TB disk,1024,2048,4096 bytes/secotr,this app can not work.I found it on http://www.2tdisk.com
|
|
|
|
 |
|
 |
In windows the drive letter of Hard Disks Start from A: to Z:.
Is the Drive letter Assignment is done by Windows?
How can I get and Set Drive letter information of a whole Hard Drive?
|
|
|
|
 |
|
 |
Hi nice code. I would just like to know if it is also possible to add extra information like identifying the disk type (floppy or other mass media (SD/MMC))
Thanx. I badly need it for my project
|
|
|
|
 |
|
 |
I think there is an API: GetDriveInfo() that you can get useful information about a disk drive.
A. Riazi
|
|
|
|
 |
|
 |
oh great Thanks so much exactly what i was looking for^^
greetz
|
|
|
|
 |
|
 |
ba salam khedmateh aghayeh riazi,
az ashanei ba shoma kheyli khoshhal shodam,
az controly ke sakhteid besiar moteshakeram,
esmeh man mehran ast va 18 sal daram va hodoodeh 2 sal ast ke barnameh nevisi ba c++ ra shoroo kardeam vali bazi oghat ba moshkelat va saalati rooberoo mishavam ke ehtiag be kasi daram ke betavanad be anha pasokh dahad,
doostdashtam ba shoma bishtar ashna shavam va agar emkan sashteh bashad soalate khod ra dar in zamineh ba shoma darmian begozaram,
ba ehteram,
MEHRAN
|
|
|
|
 |
|
 |
Exchanging the ideas,thoughts and views in international language is good for the sites like this
Indians are too lazy with genius minds
|
|
|
|
 |
|
|
 |
|
 |
salam
bebakhshid aghaye riazi man inja minevisam
agar momkene Emaile toon ro befarmaeed
bye(ye ki az shagerdan)
|
|
|
|
 |
|
 |
Hi, here my improovement of thi GREAT control. (Easy to use but useful!)
Here are my code-changes:
In the DriveInf.cpp in method
void CDriveInfo::DrawDrivePie(CDC &dc)
comment out the line reading:
rectArea.DeflateRect(1, 1);
because of an drawing error:
Improvement as following:
show percent of each piece from pie:
replace the following function by this code:
void CDriveInfo::DrawLegends(CDC &dc)
{
if (m_DriveLetter.IsEmpty())
return;
ULARGE_INTEGER Zero={0};
if (m_Capacity.QuadPart==Zero.QuadPart)
return;
CRect rectArea;
GetClientRect(&rectArea);
rectArea.top = rectArea.top;// + DEFAULT_MARGIN;
rectArea.right = rectArea.right - DEFAULT_MARGIN;
rectArea.left = rectArea.left + DEFAULT_MARGIN;
rectArea.bottom = rectArea.bottom - rectArea.Height()*3/5 - DEFAULT_MARGIN;
CRect Line1, Line2, Line3;
Line1 = Line2 = Line3 = rectArea;
Line1.bottom = rectArea.top + rectArea.Height()/3;
Line2.top = Line1.bottom;
Line2.bottom = rectArea.bottom - rectArea.Height()/3;
Line3.top = Line2.bottom;
CFont FontTitle;
FontTitle.CreateFont(13, 0, 0, 0, 0, FALSE,FALSE, 0,
//FontTitle.CreateFont(15, 0, 0, 0, 0, FALSE,FALSE, 0,
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Arial");
CFont* pOldFont=(CFont*) dc.SelectObject(&FontTitle);
CString Title;
ULARGE_INTEGER temp={0};
if ((__int64)m_Capacity.QuadPart > 1024.0*1024.0*1024)
Title.Format("Capacity: %2.2f GB", (__int64)m_Capacity.QuadPart/1024.0/1024.0/1024.0);
else if ((__int64)m_Capacity.QuadPart > 1024.0*1024.0)
Title.Format("Capacity: %2.2f MB", (__int64)m_Capacity.QuadPart/1024.0/1024.0);
else
Title.Format("Capacity: %2.2f KB", (__int64)m_Capacity.QuadPart/1024.0);
dc.TextOut(Line1.left,
Line1.top + DEFAULT_MARGIN,
Title);
if ((__int64)m_Used.QuadPart > 1024.0*1024.0*1024)
Title.Format("Used: %2.2f GB", (__int64)m_Used.QuadPart/1024.0/1024.0/1024.0);
else if ((__int64)m_Used.QuadPart > 1024.0*1024.0)
Title.Format("Used: %2.2f MB", (__int64)m_Used.QuadPart/1024.0/1024.0);
else
Title.Format("Used: %2.2f KB", (__int64)m_Used.QuadPart/1024.0);
dc.SetTextAlign(TA_RIGHT);
dc.TextOut(Line2.right, Line2.top, Title);
//dc.TextOut(Line2.left + DEFAULT_MARGIN*3 ,//+ Line2.Width()/5,
// Line2.top,
// Title);
if ((__int64)m_Free.QuadPart > 1024.0*1024.0*1024)
Title.Format("Free: %2.2f GB", (__int64)m_Free.QuadPart/1024.0/1024.0/1024.0);
else if ((__int64)m_Free.QuadPart > 1024.0*1024.0)
Title.Format("Free: %2.2f MB", (__int64)m_Free.QuadPart/1024.0/1024.0);
else
Title.Format("Free: %2.2f KB", (__int64)m_Free.QuadPart/1024.0);
dc.TextOut(Line3.right, Line3.top - DEFAULT_MARGIN, Title);
//// DRAW PERCENT
GetClientRect(rectArea);
dc.SelectObject(pOldFont);
CFont FontPercent;
FontPercent.CreateFont(12, 0, 0, 0, 0, FALSE,FALSE, 0,
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Arial");
pOldFont=(CFont*) dc.SelectObject(&FontPercent);
dc.SetTextAlign(TA_RIGHT);
dc.SetBkMode(TRANSPARENT);
rectArea.top = rectArea.top + rectArea.Height()*2/5 + DEFAULT_MARGIN;
rectArea.right = rectArea.right - DEFAULT_MARGIN;
rectArea.left = rectArea.left + DEFAULT_MARGIN;
rectArea.bottom = rectArea.bottom - DEFAULT_MARGIN;
int CenterX, CenterY, radius;
CenterX=rectArea.left + rectArea.Width()/2;
CenterY=rectArea.top + rectArea.Height()/2;
radius=min(rectArea.Height(), rectArea.Width()) / 2;
CRect pieRect;
pieRect.top = CenterY - radius;
pieRect.left = CenterX - radius;
pieRect.bottom = CenterY + radius;
pieRect.right = CenterX + radius;
float uPercentUsed = ((float)((__int64)m_Used.QuadPart) / (float)((__int64)m_Capacity.QuadPart) )*100.0;
float uPercentFree = ((float)((__int64)m_Free.QuadPart) / (float)((__int64)m_Capacity.QuadPart) )*100.0;
Title.Format("%2.1f%%",uPercentUsed);
dc.SetTextColor(USED_RGB);
dc.TextOut(rectArea.right, pieRect.top-DEFAULT_MARGIN, Title);
Title.Format("%2.1f%%",uPercentFree);
dc.SetTextColor(FREE_RGB);
dc.TextOut(rectArea.right, pieRect.bottom-DEFAULT_MARGIN-2, Title);
// draw colored squares
CBrush UsedBrush, FreeBrush;
CRect FreeRect, UsedRect;
UsedRect.top=Line2.top;
UsedRect.left=Line2.left;// + DEFAULT_MARGIN * 2;
UsedRect.right=UsedRect.left + DEFAULT_MARGIN * 3 - 2;
UsedRect.bottom=UsedRect.top + DEFAULT_MARGIN * 3 - 2;
UsedBrush.CreateSolidBrush(USED_RGB);
dc.FillRect(&UsedRect,&UsedBrush);
FreeRect.top=Line3.top - DEFAULT_MARGIN;
FreeRect.left=Line3.left ;//+ DEFAULT_MARGIN * 2;
FreeRect.right=FreeRect.left + DEFAULT_MARGIN * 3 - 2;
FreeRect.bottom=FreeRect.top + DEFAULT_MARGIN * 3 - 2;
FreeBrush.CreateSolidBrush(FREE_RGB);
dc.FillRect(&FreeRect,&FreeBrush);
dc.SelectObject(pOldFont);
}
thatz all folks!
Hope U enjoy the modification
Greetingz from da HackMan
|
|
|
|
 |
|
 |
Thank you for sharing your efforts.
A. Riazi
|
|
|
|
 |
|
 |
I agree with Bitterman, this is a good article: nicely laid out, well said, and professional yet friendly. That you cited other sources shows integrity and consideration. I also look forward to any future articles you might submit.
Cheers
|
|
|
|
 |
|
 |
Thanks!
A. Riazi
|
|
|
|
 |
|
 |
Compailing the project I get 19 errors in the cast:
C:\Download\DriveInfo_demo\DriveInfo\DriveInfo.cpp(117) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
at line
Slice[0] = (double) (m_Used.QuadPart * 1.0 / m_Capacity.QuadPart);
How solve the problem?
|
|
|
|
 |
|
 |
Do you have latest platform SDK?
A. Riazi
|
|
|
|
 |
|
 |
Yes, I have the SDK Last Updated October 2002.
in Visual C++ SP5, WinME.
|
|
|
|
 |
|
 |
change following line
Slice[0] = (double) (m_Used.QuadPart * 1.0 / m_Capacity.QuadPart);
to
Slice[0] = (double) ((__int64) m_Used.QuadPart * 1.0 / (__int64) m_Capacity.QuadPart);
A. Riazi
|
|
|
|
 |
|
|
 |
|
 |
While I personally don't have a current need for this, it is very refreshing to see someone posting an article other than "here's my code, enjoy". It's short article, and probably doesn't show anything that hard-code developers don't already know, but showing the actual steps it took to get to the end result and linking to the other article that you used as a basis shows true attention to detail and writing for your target audiance. Well done!
Through 86 years of perpetual motion, if he likes you he'll smile and he'll say,
"Some of it's magic, some of it's tragic, but I had a good life all the way"
|
|
|
|
 |
|
|
 |