Click here to Skip to main content
16,011,611 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Will .. any body tell me zbut Zoom in and Zoom out of Picture Pin
alex.barylski2-Aug-04 7:20
alex.barylski2-Aug-04 7:20 
GeneralRe: Rendering Performance gets better with Windows Media Player??? Pin
V.2-Aug-04 2:39
professionalV.2-Aug-04 2:39 
GeneralRe: Rendering Performance gets better with Windows Media Player??? Pin
baboguru2-Aug-04 2:48
baboguru2-Aug-04 2:48 
Generalcreating a MS Acess database Pin
si_692-Aug-04 1:52
si_692-Aug-04 1:52 
GeneralRe: creating a MS Acess database Pin
Manfred Staiger2-Aug-04 2:13
Manfred Staiger2-Aug-04 2:13 
GeneralRe: creating a MS Acess database Pin
si_692-Aug-04 2:22
si_692-Aug-04 2:22 
QuestionHow can find free space in hard drive? Pin
Rajesh_K_Sharma2-Aug-04 0:54
Rajesh_K_Sharma2-Aug-04 0:54 
AnswerRe: How can find free space in hard drive? Pin
wb2-Aug-04 1:17
wb2-Aug-04 1:17 
dont punch me, if this doesnt work.. I wrote this 4 years ago...

void CPathPage::LoadDrives()
{
   char cDriveList[DRIVE_LEN*MAX_DRIVES];
   char cDrive[DRIVE_LEN];
	int iDriveCount=GetLogicalDriveStrings(DRIVE_LEN*MAX_DRIVES, cDriveList)/DRIVE_LEN;
   UINT uDriveType;
	
   while(iDriveCount)
   {
      --iDriveCount;
      strncpy(cDrive,cDriveList+(iDriveCount*DRIVE_LEN),4);
      uDriveType=GetDriveType(cDrive);
      if(uDriveType==DRIVE_FIXED || uDriveType==DRIVE_REMOTE || uDriveType==DRIVE_RAMDISK)
      {
         InsertDrive(cDrive);
      }
   }
}


CString CPathPage::FormatSize(__int64 iSize)
{
   CString sRet;
   if(iSize>1024*1024*1024)
   {
      sRet.Format("%I64d Gb",iSize/(1024*1024*100));
      sRet.Insert(sRet.GetLength()-4,'.');
   }
   else if(iSize>1024*1024)
   {
      sRet.Format("%I64d Mb",iSize/(1024*100));
      sRet.Insert(sRet.GetLength()-4,'.');
   }
   else if(iSize>1024) 
   {
      sRet.Format("%I64d Kb",iSize/(100));
      sRet.Insert(sRet.GetLength()-4,'.');
   }
   else 
      sRet.Format("%I64d byte",iSize);
   return sRet;
}

__int64 CPathPage::GetDriveSize(CString sDrive,BOOL bFree/*=FALSE*/)
{

   ULARGE_INTEGER i64FreeBytesToCaller;
   ULARGE_INTEGER i64TotalBytes;
   ULARGE_INTEGER i64FreeBytes;

   i64FreeBytesToCaller.QuadPart=0;
   i64TotalBytes.QuadPart=0;
   i64FreeBytes.QuadPart=0;
   
   if(GetProcAddress( GetModuleHandle("kernel32.dll"),"GetDiskFreeSpaceExA"))  //have the funkie
   {
      GetDiskFreeSpaceEx((LPCSTR)sDrive,&i64FreeBytesToCaller,&i64TotalBytes,&i64FreeBytes);      
   }
   else 
   {
      DWORD dwSectPerClust;
      DWORD dwBytesPerSect;
      DWORD dwFreeClusters;
      DWORD dwTotalClusters;
      GetDiskFreeSpace (sDrive, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters,  &dwTotalClusters);
      
      i64FreeBytesToCaller.QuadPart=dwSectPerClust*dwBytesPerSect*dwFreeClusters;
      i64TotalBytes.QuadPart=dwSectPerClust*dwBytesPerSect*dwTotalClusters;

   }

   if(bFree)
         return i64FreeBytesToCaller.QuadPart;
   else
         return i64TotalBytes.QuadPart;

}

void CPathPage::InsertDrive(CString sDrive)
{

   char cDriveName[MAX_DRIVES];
   GetVolumeInformation(sDrive,cDriveName,MAX_DRIVES,0,0,0,0,0);
   
   if(strlen(cDriveName))
      m_lDrives.InsertItem(0,sDrive+CString("    [") + cDriveName + CString("]"));
   else
      m_lDrives.InsertItem(0,sDrive);
   m_lDrives.SetItemText(0,1,FormatSize(GetDriveSize(sDrive)));
   m_lDrives.SetItemText(0,2,FormatSize(GetDriveSize(sDrive,TRUE)));
   m_lDrives.SetItemText(0,3,FormatSize(GetDriveSize(sDrive,TRUE)));   
   DWORD dDrive=0;
   strncpy((char*)&dDrive,(LPSTR)(LPCSTR)sDrive.Left(1),1);
   m_lDrives.SetItemData(0,dDrive);  //get the driveletter

}
Big Grin | :-D
Questionhow to ZOOM a Bmp Picture Pin
Zeeshan Bilal2-Aug-04 0:51
Zeeshan Bilal2-Aug-04 0:51 
GeneralDLL works with C++, but linker error with C Pin
normanS2-Aug-04 0:40
normanS2-Aug-04 0:40 
GeneralPROBLEM SOLVED Pin
normanS2-Aug-04 1:51
normanS2-Aug-04 1:51 
QuestionHow to copy a LPWSTR? Pin
ting6682-Aug-04 0:06
ting6682-Aug-04 0:06 
AnswerRe: How to copy a LPWSTR? Pin
NormDroid2-Aug-04 0:40
professionalNormDroid2-Aug-04 0:40 
AnswerRe: How to copy a LPWSTR? Pin
Milton Karimbekallil2-Aug-04 0:51
Milton Karimbekallil2-Aug-04 0:51 
Questionhow to print a CString Pin
V.1-Aug-04 23:46
professionalV.1-Aug-04 23:46 
AnswerRe: how to print a CString Pin
Roger Allen1-Aug-04 23:59
Roger Allen1-Aug-04 23:59 
GeneralRe: how to print a CString Pin
V.2-Aug-04 2:36
professionalV.2-Aug-04 2:36 
QuestionHow to display part of Meta File Pin
Azghar Hussain1-Aug-04 23:40
professionalAzghar Hussain1-Aug-04 23:40 
QuestionCheck if download? Pin
Larsson1-Aug-04 22:50
Larsson1-Aug-04 22:50 
Question[MFC] How can I print a HTML file using the WebBrowser AcvtiveX? Pin
Erik1-Aug-04 22:49
Erik1-Aug-04 22:49 
GeneralSearch node in IXMLDOMDocument Pin
JensB1-Aug-04 22:46
JensB1-Aug-04 22:46 
GeneralRe: Search node in IXMLDOMDocument Pin
Antony M Kancidrowski2-Aug-04 0:09
Antony M Kancidrowski2-Aug-04 0:09 
GeneralRe: Search node in IXMLDOMDocument Pin
JensB2-Aug-04 1:25
JensB2-Aug-04 1:25 
GeneralRe: Search node in IXMLDOMDocument [modified] Pin
Antony M Kancidrowski2-Aug-04 3:08
Antony M Kancidrowski2-Aug-04 3:08 
GeneralRe: Search node in IXMLDOMDocument Pin
palbano2-Aug-04 6:26
palbano2-Aug-04 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.