drive info

jurij
jurij used Ask the Experts™
on
How to determine drive size / free space / label / etc. in visual studio c++ (6)?
A short example if you will, please!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
jkr
Top Expert 2012

Commented:

Author

Commented:
Tought so..
Why does my app crash,when i try to use

ULARGE_INTEGER free;
ULARGE_INTEGER total;
ULARGE_INTEGER totalfree;

GetDiskFreeSpaceEx("C:\\",free,total,totalfree);

I get the same resoults with GetVolumeInformation(..).
Any clues?
TNX!

Author

Commented:
free and the others are pointers to ULARGE_INTEGER..
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

jkr
Top Expert 2012

Commented:
ULARGE_INTEGER free;
ULARGE_INTEGER total;
ULARGE_INTEGER totalfree;

GetDiskFreeSpaceEx("C:\\",&free,&total,&totalfree);

Author

Commented:
Of course! TNX!

One more problem...
Tha data I recive is not correct.. Is "C:\\" right? or am I using my variables wrong?
my code afther I recive the data:

tmp tmp[15];
sprintf(tmp,'\n',free);
m_output.SetSelection(tmp);

TNX!
 
Top Expert 2012
Commented:
Use

char tmp[15];
sprintf(tmp,"%I64d\n",free);
m_output.SetSelection(tmp);

Author

Commented:
TNX - it works.. but i don't know how to calculate used space - i can't substract two ULARGE_INTEGERs?

And I having some problems with "GetVolumeInformation" too.
----------------------------------------------------------
     char type_FS;
     DWORD name_length;
     DWORD serial_num;
     char name;

GetVolumeInformation("C:\\",&name,30,&serial_num,&name_length,NULL,&type_FS,10);
     sprintf(tmp,"%d",name);
     m_name.ReplaceSel(tmp);

     sprintf(tmp,"%d",serial_num);
     m_serial_num.ReplaceSel(tmp);

     sprintf(tmp,"%d",type_FS);
     m_FS.ReplaceSel(tmp);
----------------------------------------------------------
All I get are some strange numbers - thoug i should get some characters - at least for drive name and stuff..
My output:
name: 84
serial_num: 185212388
FS_type: 70
I can't make heads or tails from this.. :/

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial