Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Hard Disk Free space

Hard Disk Free space

Scheduled Pinned Locked Moved C / C++ / MFC
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    parichaybp
    wrote on last edited by
    #1

    Hi, I have to display the Hard Disk free space in the Edit box, can anyone plz tell what function we have to use for calculating Hard disk free space and didplaying it in a edit box in read only mode. Regards, Parichay.

    M H K 3 Replies Last reply
    0
    • P parichaybp

      Hi, I have to display the Hard Disk free space in the Edit box, can anyone plz tell what function we have to use for calculating Hard disk free space and didplaying it in a edit box in read only mode. Regards, Parichay.

      M Offline
      M Offline
      Mila025
      wrote on last edited by
      #2

      Hi, BOOL GetDiskFreeSpaceEx( LPCTSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailable, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); where: lpDirectoryName - Pointer to a null-terminated string that specifies a directory on the disk of interest. If this parameter is NULL, the function uses the root of the current disk. You can use i.e.: std::stringstream sstr; sstr << lpTotalNumberOfFreeBytes << _T( " bytes" ); SetWindowText( hWnd, sstr.str().c_str() ); where hWnd is a handle to editbox window. ----------- Mila

      P 1 Reply Last reply
      0
      • M Mila025

        Hi, BOOL GetDiskFreeSpaceEx( LPCTSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailable, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); where: lpDirectoryName - Pointer to a null-terminated string that specifies a directory on the disk of interest. If this parameter is NULL, the function uses the root of the current disk. You can use i.e.: std::stringstream sstr; sstr << lpTotalNumberOfFreeBytes << _T( " bytes" ); SetWindowText( hWnd, sstr.str().c_str() ); where hWnd is a handle to editbox window. ----------- Mila

        P Offline
        P Offline
        parichaybp
        wrote on last edited by
        #3

        Hi Mila, Thank u very much for the reply. Now i have edit box by name IDC_SPACE , i want to know how to display the output in edit box. it should show the free space when the dialog box is loaded. how to use hwnd ??

        W M 2 Replies Last reply
        0
        • P parichaybp

          Hi Mila, Thank u very much for the reply. Now i have edit box by name IDC_SPACE , i want to know how to display the output in edit box. it should show the free space when the dialog box is loaded. how to use hwnd ??

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          Use the SendMessage() or SendDlgItemMessage() function passing along the text you want to enter as the lParam and WM_SETTEXT as the message.

          P 1 Reply Last reply
          0
          • W Waldermort

            Use the SendMessage() or SendDlgItemMessage() function passing along the text you want to enter as the lParam and WM_SETTEXT as the message.

            P Offline
            P Offline
            parichaybp
            wrote on last edited by
            #5

            Hi, Can u please tell me how to use the space calculating function and where the code should be placed so that wehn dialog window loads edit box should have free space calculated.

            M 1 Reply Last reply
            0
            • P parichaybp

              Hi, I have to display the Hard Disk free space in the Edit box, can anyone plz tell what function we have to use for calculating Hard disk free space and didplaying it in a edit box in read only mode. Regards, Parichay.

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              Hi parichaybp , http://www.codeproject.com/win32/harddiskspace.asp[^] or http://www.codeproject.com/file/ngdiskspacemonitor.asp[^]

              1 Reply Last reply
              0
              • P parichaybp

                Hi, I have to display the Hard Disk free space in the Edit box, can anyone plz tell what function we have to use for calculating Hard disk free space and didplaying it in a edit box in read only mode. Regards, Parichay.

                K Offline
                K Offline
                kiran janaswamy
                wrote on last edited by
                #7

                check with GetVolumeInformation(...) Api to get the HardDisk Info. cheers, uday. uday kiran

                D 1 Reply Last reply
                0
                • P parichaybp

                  Hi, Can u please tell me how to use the space calculating function and where the code should be placed so that wehn dialog window loads edit box should have free space calculated.

                  M Offline
                  M Offline
                  Mila025
                  wrote on last edited by
                  #8

                  So if project is MFC you can do: std::stringstream sstr; sstr << lpTotalNumberOfFreeBytes << _T( " bytes" ); GetDlgItem( IDC_SPACE )->SetWindowText( sstr.str().c_str() ); ----------- Mila

                  1 Reply Last reply
                  0
                  • P parichaybp

                    Hi Mila, Thank u very much for the reply. Now i have edit box by name IDC_SPACE , i want to know how to display the output in edit box. it should show the free space when the dialog box is loaded. how to use hwnd ??

                    M Offline
                    M Offline
                    Mahesh Kulkarni
                    wrote on last edited by
                    #9

                    write the code of GetDiskFreeSpaceEx in OnInitDialog Of that particular dialog. And show it in edit boxes using SetDlgItemText API. Mahesh Kulkarni The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

                    1 Reply Last reply
                    0
                    • K kiran janaswamy

                      check with GetVolumeInformation(...) Api to get the HardDisk Info. cheers, uday. uday kiran

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      Exactly how can GetVolumeInformation() be used to get the hard disk free space? :rolleyes:


                      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                      "There is no death, only a change of worlds." - Native American Proverb

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups